Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created August 29, 2012 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/3515752 to your computer and use it in GitHub Desktop.
Save walterdavis/3515752 to your computer and use it in GitHub Desktop.
var images = $('photoBox').hide().select('img');
var picker = new Element(
'select',
{id: 'background-picker', size: 1}
);
images.each(function(img){
picker.options[picker.options.length] = new Option(img.alt, img.src);
});
picker.observe('change', function(evt){
document.body.background = $F(picker);
});
document.body.background = images.first().src;
$('pickerBox').insert(picker);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment