jquery 图片循环显示
http://lichengyezi.iteye.com/blog/544198
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script src="http://www.cssrain.cn/demo/JQuery+API/jquery-1[1].2.1.pack.js" type="text/javascript"></script> <style type="text/css"> * {margin:0;padding:0;font-size:12px;font-family:Verdana;} img {border:0} #pic{margin:5px;width:300px;height:200px;overflow:hidden;cursor:pointer;} #play{position:absolute;margin-left:200px;margin-top:-30px;} #play a{text-decoration: none;border:1px solid #CEDEF7;background-color:#E8FCEB;width:20px;height:20px;color:#2F49DF;display:block;float:left;text-align:center;line-height:20px;margin-right:3px;} </style> <script type="text/javascript"> var _c = _h = 0; $(function(){ $('#play > a').click(function(){ var i = $(this).attr('alt') - 1; clearInterval(_h); _c = i; play(); change(i); }) $("#pic img").hover(function(){clearInterval(_h)}, function(){play()}); play(); }) function play() { _h = setInterval("auto()", 1000); } function change(i) { $('#play > a').css('background-color','#E8FCEB').eq(i).css('background-color','#C6FF5E').blur(); $("#pic img").hide().eq(i).fadeIn('slow'); } function auto() { _c = _c > 2 ? 0 : _c + 1; change(_c); } </script> <title>js图片播放轮换</title> </head> <body> <div id="pic"> <img src="http://www.cssrain.cn/demo/pic/cssrain-logo.JPG" width="300" height="200" alt="" /> <img src="http://www.cssrain.cn/demo/pic/usbmingpian.jpg" width="300" height="200" alt="" /> <img src="http://www.cssrain.cn/demo/pic/ganyingdeng2.jpg" width="300" height="200" alt="" /> <img src="http://www.cssrain.cn/demo/pic/ganyingdeng.jpg" width="300" height="200" alt="" /> </div> <div id="play"> <a href="###" alt="1" style="background-color:#C6FF5E">1</a> <a href="###" alt="2" >2</a> <a href="###" alt="3" >3</a> <a href="###" alt="4" >4</a> </div> <br/><br/><br/><br/> <div>转:<a href="http://koyoz.com">koyoz.com</a> </div> </body> </html>
相关推荐
cas的无名 2020-02-18
chouliqingke 2020-02-13
云端轻躺 2007-09-04
GonaShrimp 2019-09-02
lionelf 2012-04-07
shouen 2011-01-26
流萤 2019-06-26
dalong 2013-07-22
阳光之吻 2019-06-21
zgxzowen 2008-08-21
gcong 2019-06-13
liubang000 2015-08-17
sunshunli 2011-03-11
yangxinhua 2018-12-31
学无涯愈进而愈惘 2018-08-30
yinghuihong 2018-02-25
81751330 2017-11-17