scroll-lock-body
Version:
scroll lock the body and remember the position
8 lines (7 loc) • 841 B
JavaScript
/*!
* scroll-lock-body v0.0.11
* (c) kunukn
* Released under the MIT License.
*/
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).scrollLockBody={})}(this,(function(e){"use strict";var o="data-scroll-lock-is-active",t=document.documentElement;e.disableScrollLock=function(){var e=document.body.style.marginTop;document.body.style.marginTop="",t.removeAttribute(o),e&&window.scrollTo(0,-1*parseInt(e||"0"))},e.enableScrollLock=function(){window.scrollY&&(document.body.style.marginTop="-"+window.scrollY+"px"),t.setAttribute(o,"")},e.isScrollLockEnabled=function(){return null!=t.getAttribute(o)},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map