Created
December 10, 2009 20:03
-
-
Save bdotdub/253619 to your computer and use it in GitHub Desktop.
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
function rotatePages() { | |
if (navigator.appVersion.indexOf('iPhone OS ') < 0) { // Don't rotate on iPhone. | |
posts = document.getElementsByClassName('postRotationContainer'); | |
for (i = 0; i < posts.length; i++) { | |
// console.log("Post "+i+": Height: "+posts[i].clientHeight+" Current:"+posts[i].style.webkitTransform); | |
if (typeof posts[i].parentNode.className == 'string' // we can read the parent's classname | |
&& posts[i].parentNode.className.indexOf('noRotation') < 1 // - and it's not set to noRotation | |
&& ! posts[i].style.webkitTransform) // - and not already rotated | |
{ | |
posts[i].style.webkitTransform = 'rotate(' + ((Math.random() * maxRotationAngle * 2) - maxRotationAngle) + 'deg)'; | |
posts[i].style.MozTransform = 'rotate(' + ((Math.random() * maxRotationAngle * 2) - maxRotationAngle) + 'deg)'; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment