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.

Get hired at Prevent Body Scroll on Click

We've partnered with startups.gallery to help you find new opportunities at the leading startups in design, development, and AI.

Industries

Creators

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

Curated: 
2.11.22

Similar items

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

“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

Workway

12.9.25

Made Light Wheels

12.9.25

CSS Wrapped 2025

12.9.25

Frequency Breathwork

12.9.25

Gradient Labs

12.8.25

Weaverbird

12.8.25

Trust Keith

12.8.25

Mast

3.13.23

Whalesync

1.8.23

N47

12.1.25

Paris by Emily

12.1.25

Interactive SVG Animations

12.1.25

OneTech

12.1.25

Jetboost

12.3.19

Fathom Analytics

12.1.22

Audienceful

8.1.22

<divs> Webflow component library

11.22.25

Pablo

11.22.25

Raydian

11.22.25

Paper Tiger

11.21.25

Outseta

8.13.20

Slater

6.2.23

Making UX Decisions

11.15.25

Efecto

11.14.25

Memberstack

12.3.19

Konpo Studio

11.13.25

Tesoro

11.13.25

Kudanil Explorer

11.11.25

React Email

11.11.25

Let's Do This

11.11.25

Osmo

€25/mo
11.10.25

Claimable

11.4.25

Affinity

11.2.25

Hugeicons Webflow App

10.30.25

Flint

10.30.25

Finsweet Extension Webflow App

10.30.25

Webflow Code Component Deploy

10.30.25

Context7

10.30.25

Good Friends Agency

10.28.25

Hubspot Webflow App

10.23.25

Brainfish

10.22.25

Superplan

10.22.25

Reve

10.22.25

Oratory

10.18.25

Brand Appart

10.17.25

Arc

10.15.25

Lando Norris

10.15.25
Load more

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.