The entire library has been rewritten to improve simplicity and maintainability.
Previously, it exported a class that observed the class
attribute changes and listened for scroll
and resize
events to update CSS variables.
import ScrollPadlock from "scroll-padlock";
const scrollPadlock = new ScrollPadlock();
document.scrollingElement.classList.add("scroll-padlock-locked");
It now exports a function that updates the CSS variables and can be called when needed.
import { setStyle } from "scroll-padlock";
setStyle();
document.scrollingElement.classList.add("scroll-padlock");