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.

Greaterthan

2.20.25

Elementor

2.20.25

System Of A Down

2.19.25

Eco

2.19.25

Zyphra

2.18.25

ImageFX

2.18.25

Midlife Engineering

2.18.25

Milhoan Design

2.18.25

Dylan Brouwer

2.17.25

Byooooob

2.16.25

Softgen

2.15.25

Loti

2.15.25

WeWeb 3.0

2.15.25

Clean Styles Webflow App

2.15.25

Flowman

2.14.25

AI is the New Medium

2.12.25

Astral Frontier

2.12.25

Medusa

2.10.25

Webflow SEO Checklist

2.7.25

Fluid Builder Webflow App

2.6.25

Jace AI

2.4.25

Build Canada

2.4.25

Storipress

2.3.25

Metabase

2.3.25

Dessn

2.3.25

Powersave

2.3.25

Daniel Sun

2.3.25

GitHub Next

1.31.25

GitHub Mosaic

1.31.25

Stripe Webflow App

1.31.25

Basedash

1.29.25

Lil Frog

1.29.25

Line Height Trim

1.28.25

Runloop AI

1.28.25

Portal

1.28.25

Proper Prompts

1.28.25

Tempo Labs

1.27.25

Hishaam

1.27.25

Vellar Sound

1.27.25

Studio Direction

1.27.25

Digidop

1.27.25

Onlook

1.27.25

Bulk edit SEO title and description in Webflow

1.25.25

Val town

1.23.25

Sygnal Attributes

1.23.25

Dropbox Brand Guidelines

1.18.25

SingleStore

1.14.25

Radius Calculator

1.14.25

Snowhouse Studio | Year in Review 2024

1.14.25

Framer Commerce

1.11.25

State of JavaScript 2024

1.8.25

Agent Pages

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