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.

Scada

4.16.24

How to Understand Webflow Pricing

4.16.24

How to Design Better

4.15.24

Switchboard

4.15.24

Atoms.

4.15.24

ThoughtFull™

4.15.24

Special Guest

4.15.24

Partnom Creative

4.15.24

Jules Bassoleil

4.15.24

Thomas Provost

4.15.24

Konpo

4.14.24

Docusign Brand

4.13.24

FORFX

4.12.24

Tedy

4.11.24

Strut

4.11.24

Hang

4.10.24

Wedge

4.9.24

Plain Sight Ventures

4.9.24

Workshop

4.9.24

Supernormal Greens

4.9.24

Typescale

4.8.24

Prerender

4.8.24

Dora

4.8.24

Astro

4.8.24

Superfields

4.8.24

Armur

4.5.24

Relume Site Builder Webflow App

4.4.24

Alvaria Horizons

4.4.24

Exodus 5:1

4.4.24

Bewilder

4.4.24

Ivo

4.4.24

SupClub

4.3.24

Jessica Wells

4.3.24

NeoCultural Couture

4.3.24

Sister Mary

4.3.24

Alice App

4.2.24

Hide Section if Child CMS Collection is Empty in Webflow

4.2.24

Arensbak

4.2.24

Ben's Bites

4.1.24

Happy Valley Farms

4.1.24

gfluo Webflow App

4.1.24

Nomad Animations

4.1.24

Basefront

4.1.24

WES

4.1.24

Datalands

3.29.24

What You Need to Know about Modern CSS (Spring 2024 Edition)

3.29.24

Olivia King

3.29.24

Vandejong

3.29.24

Advocacy Through Walls

3.28.24

Logo System

3.28.24

Sergey Stanchev

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