标签:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>图片轮播</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1"> <!--需要引入jquery--> </head> <body> <div id="scrollimg"> <img src=""> <img src=""> <img src=""> </div> <script> $(function() { var numpic = $(‘#scrollimg img‘).size() - 1; var nownow = 0; var inout = 0; var TT = 0; var SPEED = 5000; var imgclomns = $(‘#scrollimg‘).find(‘img‘); var imgtxt = $(‘#imgtxt‘).find(‘div.pic_info‘); function Scroll() { var LL = nownow - 1; if (numpic >= 1) { if (nownow < numpic) { imgclomns.eq(LL).fadeOut(); imgtxt.eq(LL).hide(); imgclomns.eq(nownow).fadeIn(500); imgtxt.eq(nownow).fadeIn(1000); nownow++; } else { imgclomns.eq(LL).fadeOut(); imgtxt.eq(LL).hide(); imgclomns.eq(nownow).fadeIn(500); imgtxt.eq(nownow).fadeIn(1000); nownow = 0; } } else { imgclomns.eq(0).fadeIn(500); imgtxt.eq(0).fadeIn(1000); window.clearInterval(TT); } } Scroll(); TT = setInterval(Scroll, SPEED); }) </script> </body> </html>
标签:
原文地址:http://www.cnblogs.com/wteng/p/5395476.html