Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var photos = ['Resources/P5240181.JPG','Resources/P5240182.JPG','Resources/P5240183.JPG'];
var FREQUENCY = 5; //seconds
photos.each(function(elm,idx){
var path = elm.toString();
photos[idx] = new Image(); //preload for faster transitions
photos[idx].src = path;
});
var idx = 0;
new PeriodicalExecuter(function(){
idx = (idx + 1 < photos.length) ? idx + 1 : 0;
$(document.body).setStyle('background-image:url(' + photos[idx].src + ')');
},FREQUENCY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment