| 内容 | 有网友通过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>
 以上就是代码喽!
 
 |