Skip to content

Instantly share code, notes, and snippets.

@HektorW
Created August 22, 2014 15:07
Show Gist options
  • Save HektorW/abae50e9820cebe0c883 to your computer and use it in GitHub Desktop.
Save HektorW/abae50e9820cebe0c883 to your computer and use it in GitHub Desktop.
Dick butts for everyone
(function() {
var sources = [
'http://i2.kym-cdn.com/photos/images/newsfeed/000/697/069/753.png',
'http://i2.kym-cdn.com/entries/icons/original/000/001/030/dickbutt.jpg',
'http://i0.kym-cdn.com/photos/images/newsfeed/000/714/090/08e.jpg',
'http://i3.kym-cdn.com/photos/images/masonry/000/711/605/f6d.jpg'
];
var index = parseInt(Math.random() * sources.length, 10);
var element = document.createElement('div');
var s = element.style;
s.position = 'fixed';
s.top = '0';
s.left = '0';
s.zIndex = 10000;
s.background = 'url(' + sources[index] + ')';
s.backgroundSize = 'contain';
s.backgroundColor = 'white';
s.backgroundRepeat = 'no-repeat';
s.backgroundPosition = 'center';
function resize() {
s.width = window.innerWidth + 'px';
s.height = window.innerHeight + 'px';
}
window.addEventListener('resize', resize, false);
resize();
document.body.appendChild(element);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment