zoukankan      html  css  js  c++  java
  • 纯jquery 滚动评论

    $(function(){
    msgmove();
    $("ul").hover(function(){
    $(this).attr("name","hovered"); //鼠标经过设置ul的name值为"hovered"
    },function(){
    $(this).removeAttr("name");
    });
    });
    function msgmove(){
    var isIE=!!window.ActiveXObject;
    var isIE6=isIE&&!window.XMLHttpRequest;
    if($("ul").attr("name") != "hovered"){
    //判断ul的name属性是否为"hovered",决定下面代码块是否运行,以实现鼠标经过暂停滚动。
    var height = $("li:last").height();
    if(isIE6){
    //判断IE6,jQuery的animate动画和opacity透明在一起使用在IE6中会出现中文重影现象,
    //所以在ie6中实行透明的禁用。
    $("li:last").css({"height":0});
    }else{
    $("li:last").css({"opacity":0,"height":0});
    //列表最后的li透明和高度设置为0
    }
    $("li:first").before($("li:last"));
    //把列表最后的li提升到顶部,实现有限列表项无限循环滚动显示
    $("li:first").animate({"height":height},300);
    //列表顶部的li高度逐渐变高以把下面的li推下去
    if(!isIE6){
    $("li:first").animate({"opacity":"1"},300);
    //在非IE6浏览器中设置透明淡入效果
    }
    }
    setTimeout("msgmove()",5000);
    //设置5秒滚动一次
    }

  • 相关阅读:
    【SICP练习】80 练习2.52
    【SICP练习】79 练习2.51
    【SICP练习】78 练习2.50
    【SICP练习】77 练习2.48-2.49
    【SICP练习】76 练习2.47
    【SICP练习】75 练习2.46
    【SICP练习】74 练习2.45
    【SICP练习】73 练习2.44
    【SICP练习】72 练习2.43
    【SICP练习】71 练习2.42
  • 原文地址:https://www.cnblogs.com/zfeng/p/4269740.html
Copyright © 2011-2022 走看看