jquery - Make pictures repeat using javascript -
i want create animation using javascript.
the pictures should repeated (loop), problem when script reaches final picture there empty space.
what want is: pic1 > pic2 > pic3 > pic4 > pic5 > pic1 > ...
the code:
<style type="text/css"> img { position: absolute; center: 0px; top: 0px; } #img3 { z-index: 3; } #img2 { z-index: 2; } #img1 { z-index: 1; } </style> <img style="top: 0px; height: 199px;" src="img1.jpg" id="img1"> <img img2.jpg" id="img2"><img src="img3.jpg" id="img3"> <script src="http://code.jquery.com/jquery.js"></script> <script> $(function() { $('img').first().fadeout(2000, function suivante() { $(this).next('img').fadeout(2000,suivante); }); }); </script>
what found should use function bis() don't know how!
please try code
kee in script section
var image1 = new image() image1.src = "images/1.jpg" var image2 = new image() image2.src = "images/2.jpg" var image3 = new image() image3.src = "images/3.jpg" var image4 = new image() image4.src = "images/4.jpg" var image5 = new image() image5.src = "images/5.jpg" var image6 = new image() image6.src = "images/6.jpg" var image7 = new image() image7.src = "images/7.jpg" <img src="images/1.jpg" name="slide" style="float:left;padding-right:10px;height:100px;width:250px" /> <script> <!-- //variable increment through images var step = 1 function slideit() { //if browser not support image object, exit. if (!document.images) return document.images.slide.src = eval("image" + step + ".src") if (step < 7) step++ else step = 1 //call function "slideit()" every 2.5 seconds settimeout("slideit()", 2000) } slideit() //--> </script>
Comments
Post a Comment