Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created March 9, 2011 21:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save walterdavis/863079 to your computer and use it in GitHub Desktop.
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