Skip to content

Instantly share code, notes, and snippets.

@normanzb
Created January 17, 2012 06:51
Show Gist options
  • Save normanzb/1625280 to your computer and use it in GitHub Desktop.
Save normanzb/1625280 to your computer and use it in GitHub Desktop.
javascript that doesn't suck
// run it on http://css3.bradshawenterprises.com/demos/speed.php?rows=100
var wrapper = jQuery('#jquery').appendTo(document.body),
divset=jQuery('#jquery div').toArray();
var astop = false, render=false , hex=0;
!function () {
if (astop) return;
if (render) render();
setTimeout(arguments.callee, 0)
}();
render = function () {
if (hex > 255) {hex = 255};
wrapper.detach();
for (var l = divset.length; l--;) {
divset[l].style.backgroundColor = 'rgb(' + hex + ',' + hex + ',' + hex + ')';
}
wrapper.prependTo(document.body);
if (hex >= 255){astop=true; return;}
hex+=50;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment