javascript - Transition in image slideshow html5 -
here have done html5 image slideshow. works on localhost. wonder why there isn't transition within slideshow. transition such fading first picture letting second appear.
html codes
<!doctype html> <html lang="en"> <head> <script type="text/javascript"> <!--> var image1 = new image() image1.src = "image/s1.jpg" var image2 = new image() image2.src = "image/s2.jpg" var image3 = new image() image3.src = "image/s3.jpg" var image4 = new image() image4.src = "image/s4.jpg" var image5 = new image() image5.src = "image/s5.jpg" //--> </script> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>ipolice</title> <link rel="stylesheet" href="css/style.css" type="text/css" /> <!--[if lt ie 8]> <script src ="http://ie7-js.googlecode.com/svn/version/2.1 (beta2)/ie8.js"></script> <![endif]--> </head> <body> <ul id="slideshow"> <img src="image/s1.jpg" name="slide" width="1148px" height="250px"> <script type="text/javascript"> <!-- var step = 1 function slideit() { document.images.slide.src = eval("image" + step + ".src") if (step < 3) step++ else step = 1 settimeout("slideit()", 2500) } slideit() //--> </script> </ul>
css file
#slideshow { width: 1000px; left:-4.4%; position: absolute; margin-top: 4%; }
css3 transitions should not work that.
your code change image's src every 2500 ms, don't trigger css3 transitions.
you can have 3 images in html , show 1 of them , hide other, apply fade or other animation them.
hope help.
Comments
Post a Comment