Created
September 3, 2010 21:50
-
-
Save imagehat/564625 to your computer and use it in GitHub Desktop.
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
------------ | |
JS | |
------------ | |
// After all images load, not dom-ready | |
$(window).load(function(){ | |
if(!$("#slideshow").length) return; | |
// Images to add to slideshow | |
var images = new Array( | |
'/images/photo-2.jpg', | |
'/images/photo-3.jpg', | |
'/images/photo-4.jpg' | |
); | |
// Inject images into slideshow | |
for(var i = 0; i<images.length; i++){ | |
var img = $("<img>").attr("src", images[i]); | |
$('#slideshow').append(img); | |
} | |
// Now init cycle plugin | |
$("#slideshow").cycle(); | |
}); | |
------------ | |
HTML: | |
------------ | |
<div id="slideshow"> | |
<img src="/images/photo-1.jpg" /> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment