Created
August 8, 2012 11:21
-
-
Save ear1grey/3294348 to your computer and use it in GitHub Desktop.
Shrink text of a particular class relative to how far scrolled a page is.
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 shrinky() { | |
var q = document.querySelectorAll(".shrink"); | |
window.addEventListener( | |
"scroll", | |
function scroll () { | |
var i, z = 100-(Math.min(window.pageYOffset,100)/2); | |
for(i=0; i<q.length; i++) { | |
q[i].style.fontSize = z+"%"; | |
} | |
} | |
); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment