Skip to content

Instantly share code, notes, and snippets.

@imagehat
Created September 3, 2010 21:50
Show Gist options
  • Save imagehat/564625 to your computer and use it in GitHub Desktop.
Save imagehat/564625 to your computer and use it in GitHub Desktop.
------------
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