网站制作学习网JS脚本→正文:仿淘宝首页上下滚动广告特效
字体:

仿淘宝首页上下滚动广告特效

JS脚本 2011/7/20 18:42:15  点击:不统计


有网友通过qq群想做一个淘宝首页的上下翻动的特效。通过火狐的firebug查看是通过层的隐藏和定位来实现的。
我共用了淘宝的内容,然后通过jquery操作对其进行特效实施。

查看特效:仿淘宝首页上下滚动广告特效

jquery代码
<script language="javascript">
<!--
$(function(){
  var $t=Math.floor(Math.random()*3); //随机产生一个1-3数字 默认显示第几个
      $("#upC").click(function(){//向上点击
      $t++;if($t>=2){$t=2;$(this).addClass("disable");};
      $("#rollContent").animate({"top":-194*$t});
   $("#downC").removeClass("disable");
   $("#numShow > em").text($t*3+"-"+($t+1)*3);
    });
  $("#downC").click(function(){//向下点击
     $t--;if($t<=0){$t=0;$(this).addClass("disable");}
     $("#rollContent").animate({"top":-194*$t});
  $("#upC").removeClass("disable");
  $("#numShow>em").text($t*3+1+"-"+($t+1)*3);
  });
  $("#numShow>em").text($t*3+1+"-"+($t+1)*3);
  if($t==0)$("#downC").addClass("disable");
  if($t==2)$("#upC").addClass("disable");
  $("#rollContent").animate({"top":-194*$t});
});
-->
</script>

以上就是代码喽!


·上一篇:在线CSS压缩代码,在线CSS压缩工具 >>    ·下一篇:onmouseleave火狐firefox >>
推荐文章
最新文章