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.

Vikki B

4.20.23

4pt

$97
4.18.23

VSK

4.16.23

DocuSign

4.15.23

Rainbow Button for Webflow

4.15.23

Bones Co.

4.14.23

Montelupo

4.14.23

LORD

4.14.23

Webflow Select Input Generator

4.12.23

Process Form

4.12.23

Coherence

4.12.23

Chart.js for Webflow

4.10.23

The Browser Company

4.10.23

JP

4.10.23

Dynamic CMS Grid in Webflow

4.9.23

GSAP Text Animator

4.7.23

Open Street Map

4.7.23

Legrand Filles et Fils Paris

4.5.23

Diana Lu Portfolio

4.3.23

Framer Daily Drops

4.2.23

Free Faces

4.2.23

F1 Index

4.2.23

Space Type Generator

4.2.23

Aninix

4.2.23

Design Full-Time

$99
4.1.23

Mark Ralph

3.29.23

Will Neeteson

3.27.23

Evil Twins Airtable Kit

$179
3.26.23

ON A DAILY BASIS

3.23.23

Tagbox

3.23.23

Indieflow Studio

3.23.23

Autopailot

3.23.23

Tom Dimajo

3.23.23

Dinamo Typefaces

3.21.23

Design Business Company

3.21.23

Studio Rodrigo

3.21.23

Webflow SEO Checklist

3.19.23

Add on IDX

3.18.23

Webflow Flexbox Game

3.18.23

Superform

3.18.23

Spotify for Podcasters

3.18.23

Pixelate Images Interaction in Webflow

3.18.23

Kernel

3.17.23

Onfolk

3.17.23

Bryn Taylor

3.17.23

Good Garms

3.17.23

EigenLayer

3.16.23

Copy-Paste SVG Shapes

3.16.23

Iron Health

3.16.23

Flowclass

3.15.23

Service Production

3.15.23

Maliha Abidi

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