Well, I'm trying to get the header
of a page, receive or lose a class, depending on the position of the page, could someone tell me what's wrong, and help me fix it?
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');
}
};