1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| <html> <head> <script src="script/jquery-1.11.0.min.js"></script> </head> <body> <div id="slider"> <img style="position:absolute" src="images/sliser_bg_img_1.jpg" /> <img style="position:absolute;display:none" src="images/sliser_bg_img_2.jpg" /> <img style="position:absolute;display:none" src="images/sliser_bg_img_3.jpg" /> </div> <script> var slider = $("#slider"); var img_list = slider.children(); var current = 0; setInterval("change()", 3000); function change() { $(img_list[current]).fadeOut(800); current++; if (current >= img_list.length) { current = 0; } $(img_list[current]).fadeIn(800); } </script> </body> </html>
|