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秒滚动一次
    }

  • 相关阅读:
    第一周学习进度
    四则运算
    添加课程
    继承和多态的动手动脑
    String 方法
    【CoreData】分页查询和模糊查询
    【CoreData】表之间的关联
    代码创建storyboard
    UIWindows 使用注意
    UIApplicationDelegate
  • 原文地址:https://www.cnblogs.com/zfeng/p/4269740.html
Copyright © 2011-2022 走看看