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.

Industries

Creators

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

Curated: 
2.11.22

Similar items

Featured
Preview

Osmo

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

Hana – a canvas for interactive design

4.24.25

Warp

4.24.25

Zig Zag Creative

4.23.25

Keith Chan

4.23.25

Office of Rob Junge

4.23.25

Two Wolves

4.23.25

TwelveLabs

4.22.25

Nite Riot

4.22.25

Utile

4.22.25

Unrivaled Collectibles

4.22.25

Human Voice Over

4.22.25

Webless

4.22.25

Nordcraft

4.22.25

Gamma

4.22.25

Aida Oliva Studio

4.21.25

Accessible Accordion for Webflow

4.19.25

Zite

4.19.25

shopdev

4.19.25

Magic Animator

4.19.25

GRAPHICHUNTERS®

4.19.25

Distributional

4.17.25

Golden Canon Grid Course for Web Designers — BONT®

Free
4.16.25

RIVR

4.15.25

Stack Asset Management

4.14.25

Stereotype

4.14.25

Mast

3.13.23

OH Architecture

4.9.25

Nory

4.9.25

Whalesync

1.8.23

Greer Mosher

4.8.25

Jetboost

12.3.19

Osmo

€25/mo
4.5.25

Greenhouse

4.5.25

Heritage In Art

4.5.25

Fathom Analytics

12.1.22

Audienceful

8.1.22

Marga Navarro

4.2.25

No-Code Exits

1.21.25

Granola

3.30.25

Giga Energy

3.30.25

Outseta

8.13.20

Also

3.26.25

Slater

6.2.23

Hurry Up & Have Fun

3.24.25

Cleft Notes

3.22.25

Memberstack

12.3.19

Typography in web design course

€399
3.22.25

Modulify AI

3.22.25

Webflow Expert Course

3.22.25

Dreamr

3.22.25

Website Headlines (dotcom)

3.18.25

Plumb

3.18.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.