I would like to display or hide the menu according to the scroll of the page, I tried to develop as follows:
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'm "breaking my head" on it.
No I want to use Jquery , I need an extremely lightweight page and the only JS of the page will be this, so I'm using "pure" JS