asp-smart-ui-plus-test
Version:
A Component Library for Vue 3
23 lines (19 loc) • 691 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function preventScroll(flag) {
if (flag) {
const top = document.documentElement.scrollTop || document.body.scrollTop || 0;
document.body.style.position = "fixed";
document.body.style.width = "100vw";
document.body.style.overflow = "hidden";
document.body.style.left = "0";
document.body.style.top = `-${top}px`;
} else {
const top = document.body.style.top;
document.body.style.position = "static";
document.body.style.overflow = "";
window.scrollTo(0, Math.abs(Number.parseFloat(top)));
document.body.style.top = "";
}
}
exports.preventScroll = preventScroll;