mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Fixed #4589 - Improve block/unblockScroll architecture
This commit is contained in:
parent
b85876be95
commit
4fa7741923
9 changed files with 36 additions and 43 deletions
|
@ -564,6 +564,10 @@ export default {
|
|||
return scrollbarWidth;
|
||||
},
|
||||
|
||||
calculateBodyScrollbarWidth() {
|
||||
return window.innerWidth - document.documentElement.offsetWidth;
|
||||
},
|
||||
|
||||
getBrowser() {
|
||||
if (!this.browser) {
|
||||
let matched = this.resolveUserAgent();
|
||||
|
@ -755,5 +759,15 @@ export default {
|
|||
window.open(encodeURI(csv));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
blockBodyScroll(className = 'p-overflow-hidden') {
|
||||
document.body.style.setProperty('--scrollbar-width', this.calculateBodyScrollbarWidth() + 'px');
|
||||
this.addClass(document.body, className);
|
||||
},
|
||||
|
||||
unblockBodyScroll(className = 'p-overflow-hidden') {
|
||||
document.body.style.removeProperty('--scrollbar-width');
|
||||
this.removeClass(document.body, className);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue