Streaming live at 10am (PST)

Prevent Scroll for overlays


#1

I’m using the following code to prevent scrolling once the menu is opened. It works but I’m having an issue where it breaks my in-page linking. Any ideas what the issue could be?

<script>
Webflow.push(function() {
  $('.link').click(function(e) {
    e.preventDefault();
	$('body, html').css('overflow', 'hidden');
  });

  $('.link').click(function(e) {
    e.preventDefault();
	$('body').css('overflow', 'auto');
  });
});
</script>

I’ve tried setting the second function target to ‘body, html’ as well and it work mostly the same.

(Code is in the project setting’s custom footer code section)

https://preview.webflow.com/preview/fullscreen-menu-explore?utm_source=fullscreen-menu-explore&preview=09d82dae08c0b1fec49159c9499e53c9