Is there a way to dynamically change the scroll behavior and add or remove a class based on certain conditions? I am new to coding, so any guidance would be greatly appreciated. Thank you! :)
$(document).on("scroll", function () {
if ($(document).scrollTop() > 5000) {
$(".span-s").addClass("shrink");
} else {
$(".span-s").removeClass("shrink");
}
});
I attempted this solution but it seems like the class is not being removed when it should. Can anyone help me troubleshoot this issue?
var bottom = $('.construction').offset().top;
$(window).scroll(function () {
if ($(this).scrollTop() > bottom) {
$('.sidebar_list').addClass('shrink');
}
else {
$('.sidebar_list').removeClass('shrink');
}
});