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.
1. Add the script in the head
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".
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
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.















