Add

Lorem ipsum

Lorem ipsum

A
A
A
CMS & Logic

3 views

4 min

How to Lock Page Scrolling in Webflow with Finsweet Scroll Lock

Learn how to lock page scrolling in Webflow with Finsweet Scroll Lock: click trigger, visibility, and target.

In this tutorial, Sandro, cofounder of the Gemeos Webflow agency, shows you how to prevent page scrolling with Finsweet Attributes Scroll Lock — handy for modals and mobile menus.

AttributeElementValue
fs-scrolllock-elementTrigger elementtrigger
fs-scrolllock-eventTrigger elementclick or visible
fs-scrolllock-lockTrigger elementtrue or false
fs-scrolllock-targetTrigger elementCSS selector for the scrollable element (default: body)

1. Add the script in the head

<script src="https://cdn.jsdelivr.net/npm/@finsweet/attributes-scrolllock@1/scrolllock.js" defer>script>

2. Set up the click trigger

On the button that opens your modal or menu, add:

  • fs-scrolllock-element="trigger"
  • fs-scrolllock-event="click"
  • fs-scrolllock-lock="true" (to lock scrolling)

On the close button, add the same attributes with fs-scrolllock-lock="false".

3. Set up the visibility trigger

To lock scrolling automatically when an element becomes visible — for example, a modal opened through a Webflow Interaction — use fs-scrolllock-event="visible" on the modal element itself. Finsweet detects when it appears and locks or unlocks scrolling automatically.

4. Target a specific container (optional)

By default, Scroll Lock locks scrolling on the entire body. To lock scrolling on a specific container — for example, a sidebar — add fs-scrolllock-target="#mon-conteneur".

good to know

Finsweet Scroll Lock automatically handles the body's padding-right to compensate for the missing scrollbar width and avoid visual shifts in fixed elements like navbars and modals. That’s an important detail that CSS-only solutions (overflow: hidden on the body) don’t handle, which can cause an annoying visual jump.

Conclusion

Scroll Lock prevents background scrolling when overlays open. Use cases:

  • Modals and popups that open on the page
  • Full-screen mobile menu
  • Drawers and sidebars

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...