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

Advertise with No-Code Supply Co.

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

Overrrides

9.19.23

Henley Smith Construction

9.19.23

Ava

9.15.23

Custom Code Workflow in Webflow

9.15.23

FROST

9.14.23

Kinetic Studio

9.14.23

Replit

9.13.23

Off Menu

9.13.23

Algolia

9.13.23

Off-Grid

9.13.23

Ophelia

9.13.23

Dark/Light Mode Favicon Images

9.12.23

BEGG

9.12.23

Captions

9.12.23

Bayonet Media

9.12.23

Sabbath

9.12.23

Finsweet Table

9.5.23

Dominique Sire

9.5.23

Somefolk

9.5.23

Remove https:// From Text Link

9.4.23

Wrapbook

9.1.23

Flowplay

8.31.23

ChainGPT

8.30.23

HeyFriends!

8.29.23

Bajgart Design Office

8.28.23

Rows

8.27.23

Move Agency

8.27.23

Rebrand

8.25.23

Navs.Supply

8.25.23

BuildBetter AI

8.25.23

Middesk

8.24.23

Webflail

8.23.23

deck․gallery

8.23.23

Bunsen Studio

8.21.23

The Digital Third

8.21.23

Notion Client Portal

TBD
8.20.23

Webflow CMS Manager

TBD
8.20.23

Simple Proposal

TBD
8.20.23

Cursor

8.19.23

TextFX

8.18.23

Strategyzer

8.18.23

toddle

8.17.23

Prismic

8.17.23

Diagram

8.17.23

Mbau

8.17.23

Thenty

8.17.23

Breeona Nechole

8.16.23

Ghost

8.16.23

SEARCH

8.16.23

Minerva

8.15.23

Modyfi

8.14.23

Framer University

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