1
I’m having some problems with a function .onscroll
:
window.onscroll=function(){
if(document.documentElement.scrollTop>5){
menuPrincipal.style.backgroundColor = "rgba(0,0,0,1)";
}else{
menuPrincipal.style.backgroundColor = "rgba(0,0,0,.4)";
}
}
In this case, when do I give the scroll
on the page, it only reads the action of scroll
only once, and always enters the condition else
, because begins the scroll
in 0
as soon as release give as an answer, it worked
– Murilo Melo