Created
January 17, 2012 06:51
-
-
Save normanzb/1625280 to your computer and use it in GitHub Desktop.
javascript that doesn't suck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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