1
Well, I’m trying to get the header
from a page, receive or lose a class, depending on the position of the page, someone could inform me what is wrong, and help me fix ?
window.onscroll = function() {
var mobileTransp = document.getElementById('mobile-header');
if (document.body.scrollTop > 10 || document.documentElement.scrollTop > 10) {
mobileTransp.classList.remove('on-top');
}
else{
mobileTransp.classList.add('on-top');
}
};
What’s the matter?
– Laerte
is not working
– Murilo Melo
Not adding the class?
– Laerte
I wasn’t, but I just solved
– Murilo Melo
I suggest you post your solution in the answer. =)
– Laerte
Ready :3 thanks for the readiness
– Murilo Melo