Probably very simple, but not sure why isn't working on my side. I have a toggle button for a menu, I want to prevent Y scrolling when the button is clicked. I have the following:
$('.canvas-off-toggle').click(function(e) {
e.preventDefault();
$('.a-class').toggleClass('is-active');
$('.another-class').toggleClass('is-active');
document.body.style.overflowY = "hidden";
});
It adds the class but it doesn't seem to add it to the body and I can keep scrolling on "Y" axis. Help please?