ScrollLocker

Lock and unlock page scrolling

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/589163/1889704/ScrollLocker.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Aŭtoro
ryxel
Versio
1.2
Kreita
2026/07/30
Ĝisdatigita
2026/07/31
Size
2,03 kb
Licenco
MIT

ScrollLocker Documentation

ScrollLocker is a lightweight utility script used to lock and restore page scrolling.


Usage

Once loaded into the page, call lock() and unlock() directly on the global scrollLocker object.

1. Lock Scrolling

Call this when opening a modal, overlay, or sidebar:

scrollLocker.lock();

2. Restore Scrolling

Call this when closing the modal or restoring normal page interaction:

scrollLocker.unlock();


Properties & State

  • scrollLocker.isLocked (Boolean): Indicates whether page scrolling is currently locked (true if locked, false otherwise).
  • Repeated Calls: Calling scrollLocker.lock() while already locked will not re-trigger or duplicate styles. Calling scrollLocker.unlock() when unlocked has no effect.