Skip to content

Commit

Permalink
fix scroll check
Browse files Browse the repository at this point in the history
  • Loading branch information
smithoo committed Jan 7, 2025
1 parent a93a230 commit 3f9bca3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vlossom/src/composables/scroll-lock-composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export function useScrollLock(element: HTMLElement | null) {
originalPaddingRight.value = element.style.paddingRight;
originalPaddingBottom.value = element.style.paddingBottom;

element.style.overflow = 'hidden';

if (element.scrollHeight > element.clientHeight) {
if (element.scrollHeight >= element.clientHeight) {
element.style.paddingRight = SCROLLBAR_WIDTH;
}

if (element.scrollWidth > element.clientWidth) {
if (element.scrollWidth >= element.clientWidth) {
element.style.paddingBottom = SCROLLBAR_WIDTH;
}

element.style.overflow = 'hidden';
}, 10);
}

Expand Down

0 comments on commit 3f9bca3

Please sign in to comment.