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.

Get hired at Prevent Body Scroll on Click

We've partnered with startups.gallery to help you find new opportunities at the leading startups in design, development, and AI.

Industries

Creators

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

Curated: 
2.11.22

Similar items

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

PLYO Lab

10.24.22

Sequoia Arc

10.24.22

Whywhywhy

10.24.22

Daybreak

10.24.22

Redirect Form on Submit and Pass Input Value to URL

10.23.22

Remove HTML Tags From Webflow CMS Rich Text Export

10.22.22

Accessible Ecommerce Color Toggle Cards

10.21.22

Finiam

10.21.22

TakeProfit

10.21.22

Disco

10.21.22

admilk

10.21.22

MetaCHORS

10.21.22

Refokus Tools

10.20.22

Previously Unavailable

10.20.22

CMS Image Plotter

10.19.22

Orchestrate

10.19.22

Reinitialize Webflow Interactions

10.19.22

OH no Type Company

10.18.22

Heavyweight Digital Type Foundry

10.18.22

Phillip Lee

10.17.22

P-51 Mustang

10.16.22

Weweb

10.13.22

Rose Island

10.12.22

Margot Priolet

10.12.22

Atomus®

10.11.22

StanVision

10.11.22

Fontshare

10.10.22

Get Image Size w/ Airtable Script

10.10.22

Compress Images w/ Airtable Script

10.10.22

3 Ways to Loop Through Records w/ Airtable Scripts

10.10.22

Finsweet Attributes

10.7.22

Formly

$120/yr
10.7.22

Creating a User Portal for Airtable

10.7.22

Simple Countdown to Date/Time

10.6.22

Illustration.lol

10.4.22

Use Airtable Scripts to Resize and Crop Images

10.3.22

GetScreenshot

10.3.22

Moment.js

10.3.22

Bryte

9.30.22

Belka

9.30.22

Potential Motors

9.28.22

Eraser

9.28.22

Auth0 + Webflow

9.28.22

Metaballs

9.24.22

TailGraph

9.23.22

Where Whalesync Really Wails

9.21.22

Winden

9.20.22

Gameto

9.16.22

Debut

9.16.22

Webflow Go Live Checklist

$0+
9.15.22

VANA

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