I am currently working on a project where I need to apply a 'fixed' class to a menu when the user scrolls down to that section. While I have successfully implemented this feature, I am facing difficulties in removing the class once the user scrolls back up to the top.
You can view the site I am working on here:
Below is the JavaScript code I am using:
$(window).bind('scroll', function () {
var menu = $('.bottom-row');
if ($(window).scrollTop() >= menu.offset().top) {
menu.addClass('menufix');
} else {
menu.removeClass('menufix');
}
});