Created
June 7, 2012 12:19
-
-
Save Mouad-BGD/2888517 to your computer and use it in GitHub Desktop.
slides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| html | |
| ---- | |
| <div class="slideshow"> | |
| <h1>Text</h1> | |
| <input type="button" value="Hello" /> | |
| </div> | |
| css | |
| --- | |
| slideshow | |
| { | |
| position: relative; | |
| width: 350px; | |
| height: 150px; | |
| } | |
| .slideshow img | |
| { | |
| position: absolute; | |
| width: 350px; | |
| height: 150px; | |
| z-index:-1; | |
| } | |
| js | |
| -- | |
| var images=new Array('http://placehold.it/250x150','http://placehold.it/250x150/123456','http://placehold.it/250x150/dbca98'); | |
| var nextimage=0; | |
| doSlideshow(); | |
| function doSlideshow() | |
| { | |
| if($('.slideshowimage').length!=0) | |
| { | |
| $('.slideshowimage').fadeOut(500,function(){slideshowFadeIn();$(this).remove()}); | |
| } | |
| else | |
| { | |
| slideshowFadeIn(); | |
| } | |
| } | |
| function slideshowFadeIn() | |
| { | |
| $('.slideshow').prepend($('<img class="slideshowimage" src="'+images[nextimage++]+'" style="display:none">').fadeIn(500,function(){setTimeout(doSlideshow,1000);})); | |
| if(nextimage>=images.length) | |
| nextimage=0; | |
| } | |
| demo | |
| ----- | |
| http://jsfiddle.net/R4ZHX/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment