When users click on the hamburger icon in the top right of our mobile site, I want the drop-down menu to appear and be scrollable without the background scrolling. I tried using JavaScript to set the body to fixed
when the menu icon is clicked, but this caused the website to jump to the top of the page, which is not the desired behavior. I want the background page to remain in place when the user clicks on the menu button.
Below is the code that I have already attempted for this issue.
Javascript
jQuery(function($) {
$(".x-btn-navbar").on("click", function() {
$("body").toggleClass("noScroll");
});
});
CSS
.noScroll {
position: fixed;
}
EDIT Check out our website here: