Created
March 26, 2020 02:28
-
-
Save leocunhadev/1eb51c61d1bac1ea4cc884370c6ef9d4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // When the user scrolls the page, execute myFunction | |
| window.onscroll = function() {myFunction()}; | |
| function myFunction() { | |
| var winScroll = document.body.scrollTop || document.documentElement.scrollTop; | |
| var height = document.documentElement.scrollHeight - document.documentElement.clientHeight; | |
| var scrolled = (winScroll / height) * 100; | |
| var teste = document.querySelector('#teste'); | |
| document.getElementById("myBar").style.width = scrolled + "%"; | |
| if(scrolled >= 35){ | |
| teste.style.fontSize = (scrolled + 100) + '%'; | |
| console.log('ok'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment