Fix locked page scrolling
Forces and keeps scrolling enabled when a popup or modal has locked the page overflow.
Code to copy
(function () {
function restore() {
var html = document.documentElement;
var body = document.body;
[html, body].forEach(function (el) {
if (!el) return;
el.style.setProperty('overflow', 'auto', 'important');
el.style.setProperty('position', 'static', 'important');
el.style.removeProperty('height');
el.classList.remove('modal-open', 'no-scroll', 'noscroll',
'overflow-hidden', 'is-locked', 'scroll-lock');
});
}
restore();
var obs = new MutationObserver(restore);
obs.observe(document.documentElement, {
attributes: true,
attributeFilter: ['class', 'style'],
subtree: true
});
})();
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.