Ajouter

Lorem ipsum

Lorem ipsum

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

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