Prevent Body Scroll on Click

Prevent Body Scroll on Click

When clicking something lock the scroll of <body> if it isn’t already locked (set to overflow: hidden;). This is useful for things like opening modals, a mobile nav, etc. to ensure the user doesn’t have two levels of scrolling occurring at once.

Update the classes of .nav-button and .nav-overlay in the snippet below with the class you use on the mobile menu button and an overlay div that covers the rest of the screen if needed when the mobile menu is open. If you don’t have a separate overlay div, you can also target the native one that is part of the native Nav element in Webflow, which has the class of .w-nav-overlay.

Have feedback or a question related to this item? Drop us some feedback!

Curated: 
2.11.22

Similar items

Items
2771
Search

Give Claude Code an external monitor

1.12.26

What if you don't need MCP at all?

1.12.26

Chart Your Course - Webflow Course Template

1.12.26

Strudel REPL

1.12.26

Vizcom

1.11.26

UI Skills

1.10.26

rams

1.10.26

Welcome to Gas Town

1.7.26

CookieFlow

1.6.26

Claude Code dangerously-skip-permissions: Safe Usage Guide

1.5.26

Fly

1.5.26

Annnimate

1.5.26

Compound Engineering: How Every Codes With Agents

1.5.26

Claude Code Skills Hub

1.5.26

MagicPath

1.3.26

Design is more than code

12.22.25

Puck

12.22.25

Agent Skills

12.22.25

Institute of Health

12.22.25

“You should never build a CMS”

12.17.25

Runlayer

12.17.25

TitanGate Equity

12.13.25

Flim

12.13.25

Ballpark

12.13.25

Bummer, no results

Try a different search/filter combo, or drop us some feedback if there is something missing you would love to see!

Reset filters

Subscribe for updates

Get updates on the latest curated resources and be the first to hear of new features.

Subscribe