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.

Sheet Monkey

2.7.23

Creative South '23

2.6.23

Redis Product Design & Development

2.6.23

Diego

2.6.23

Mike Lamont

2.6.23

AvroKO

2.6.23

Ultimate CMS Slider for Webflow

2.6.23

Activepieces

2.6.23

The Best Method of Scroll Snapping!

2.5.23

Connect Webflow to Airtable, Mailchimp and Slack with Webflow Logic

2.4.23

ECAL Typefaces

2.3.23

Figma to Webflow Plugin

2.2.23

Text Connector DateTime Formats

2.2.23

Quilt

2.2.23

Optimal Controls AI

2.2.23

100 Days Of More Or Less Modern CSS

2.2.23

Memo

2.2.23

Notion Second Brain

$99
2.1.23

Whiteboard's Agency Report

2.1.23

Nucleo

$99
1.31.23

Payhip

1.31.23

Cloudpress

1.30.23

Nube

1.30.23

Automatisch

1.30.23

Deduxer Studio

1.30.23

Vev

1.28.23

Animate Along SVG Path Using GSAP

1.27.23

Clean Shot X

1.27.23

Reverse Proxy for Webflow Pt.1

1.27.23

NoCode Exits

1.26.23

August

1.26.23

Thomas Bosc

1.26.23

Versoly

1.26.23

Images Inside Text Spans in Webflow

1.26.23

Ghostwrite

1.25.23

Xnapper

1.25.23

Simple Type Co.

1.25.23

Using Webflow with Cloudflare

1.24.23

Buildcamp

1.23.23

100 Days of No-Code

1.23.23

Sammy

1.23.23

Remix Framer

1.22.23

Persistent Dark Mode Switch

1.22.23

Scrollyvideo.js

1.22.23

Iconic

$99/yr
1.22.23

Vintage Voyage Design Supply

1.22.23

Supa Palette

1.22.23

fffuel

1.22.23

Framer.supply

1.21.23

Nocode.gallery

1.21.23

LanceID

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