Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var position = 0,
images = [
'image1.jpg',
'image2.jpg',
'image3.jpg'
];
$.backstretch(images[position]);
setInterval(function() {
if(position++ > images.length) position = 0;
$("#backstretch img").attr("src", images[position]);
$(window).trigger("resize");
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment