Answer the question
In order to leave comments, you need to log in
How to change header color on page scroll?
How to make header color change on page scroll in pure JS?
Answer the question
In order to leave comments, you need to log in
If you need to change the color of the header after passing a certain mark, then something like:
document.addEventListener('resize', () => {
if (window.scrollY > 200 && heder.style.color != 'red') {
header.style.color = 'red'
} else if (header.style.color == 'red') header.style.color = 'auto'
})
function nameFunct() {
var hScroll = 0;
var hWindow = jQuery(window).height();
jQuery(window).scroll(function() {
hScroll = jQuery(this).scrollTop() + hWindow;
if (jQuery(this).scrollTop() >= 220) {
} else {
}
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question