This js add class only while Scroll Up the browser page. But problem is after Scroll Up browser to top of the page .darkHeader class are not remove, means i want to remove this class after page Scroll Up to top.
JS
lastScroll = 0;
$(window).on('scroll',function() {
var scroll = $(window).scrollTop();
if(lastScroll - scroll > 0) {
$(".nav").addClass("darkHeader");
} else {
$(".nav").removeClass("darkHeader");
}
lastScroll = scroll;
});
JSfiddle >>
How to remove .darkHeader class after page has completely scroll Up on top of page/head? How to prevent adding class without browser scrolling?