码迷,mamicode.com
首页 > Web开发 > 详细

jquery 实现多图轮换

时间:2014-11-29 19:04:58      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:jquery 实现多图轮换

<script type="text/javascript">
var t;
var speed=2;
var i=0;
function qiehuan(){
var size=$("#all").find("div").length;
$("#all").find("div").hide();
$("#all").find("div").eq(i).show();
i = i+1 == size ?0:i+1;
t=setTimeout("qiehuan()",speed*1000);
}
onload=function(){qiehuan();};
$(document).ready(function(){
$("#all").hover(function(){
clearInterval(t);
});
$("#all").mouseleave(function(){
qiehuan();
});
});
</script>
  </head>
  
  <body>
    <div id="all" style="float:left; position:relative;overflow:hidden;width:300px;height:240px;">
    <div><img width="300" height="240" src=\‘#\‘" /images/1.jpg" alt="1" /></div>
    <div><img width="300" height="240" src=\‘#\‘" /images/2.gif" alt="2"/></div>
    <div><img width="300" height="240" src=\‘#\‘" /images/Winter.jpg" alt="3"/></div>
    </div>
  </body>


本文出自 “大话程序” 博客,请务必保留此出处http://houqida.blog.51cto.com/8877896/1584496

jquery 实现多图轮换

标签:jquery 实现多图轮换

原文地址:http://houqida.blog.51cto.com/8877896/1584496

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!