2
I would like to Show or Hide the menu as per Scroll of the page, I tried to develop in the following way:
window.scrollTo(function(){
if (window.scrollTo() > 212) { // se for maior de 212 pixels some o menu
document.getElementsByTagName("nav").style.display="none";
} else {
document.getElementsByTagName("nav").style.display="block";
}
});
However it did not work, my intention is to develop a clean and small code, I am "breaking my head" in this.
OBS: Not want to use Jquery, I need an extremely light page and the only JS of the page will be this, so I’m using JS "pure"
For, exactly what I needed, and I hadn’t really thought about this performance detail, running every pixel moved, I’ll have to do the tests, thank you very much @Darkcreator
– Gabriel Masson
Not at all @Gabriel Masson.
– Silvio Lucena Junior