I'm trying to add / remove a class on a div when people scroll through the div, but the problem is that the div's height is 100vh and overflows with a vertical scroll. My current scroll function only works when you actually scroll down in the page, instead of inside the div.
Is is possible it have a similar scrollfunction that adds / removes when scrolling THROUGH a div instead of the full page?
$(function() {
var header = $("#scroller-wrapper");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 50) {
header.removeClass('scroller').addClass("scroller hidden");
} else {
header.removeClass("scroller hidden").addClass('scroller');
}
});
});