autoPlay 基于jquery的图片自动播放效果
效果图:
实现代码:
实现代码:
代码如下:
<html> <head> <title>Jquery 自动轮播效果</title> <script src="js/jquery-1.6.2.min.js" type="text/javascript"></script> <style> .spanhide{display: none;} #top a:hover{color: red;} </style> </head> <body> <div id = "main"> <div id = "top"> <a href="javascript:void(0)">1</a> <a href="javascript:void(0)">2</a> <a href="javascript:void(0)">3</a> <a href="javascript:void(0)">4</a> <a href="javascript:void(0)">5</a> </div> <div id = "tbody"> <span> <img src="images/24877.jpg" /> </span> <span class="spanhide"> <img src="images/74389.gif" /> </span> <span class="spanhide"> <img src="images/77904.jpg" /> </span> <span class="spanhide"> <img src="images/81177.jpg" /> </span> <span class="spanhide"> <img src="images/93144.jpg" /> </span> </div> </div> </body> <script type="text/javascript"> $(function(){ var i = 0; var f = 0; var t; var tops = $("#top a"); var tl = tops.length; var bodys = $("#tbody span"); tops.mouseover(function(){ i = $.inArray(this,tops); bodys.hide().eq(i).show(); i++; i = i>=tl?0:i; if (f == 1) { t = setTimeout(mmover,2000); } else{ stop(); } f = 0; }); bodys.mouseover(function(){ stop(); }); bodys.mouseout(function(){ t = setTimeout(mmover,2000); }); tops.mouseout(function(){ t = setTimeout(mmover,2000); }); mmover(); function stop(){ clearTimeout(t); } function mmover(){ f = 1; tops.eq(i).mouseover(); } }); </script> </html>
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17