Skip to content

Commit

Permalink
fix slider
Browse files Browse the repository at this point in the history
  • Loading branch information
Zh3nyaZh3nya committed Feb 20, 2024
1 parent 2922ec9 commit a27503c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/runtime/components/Pages/TestVuetify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:show-buttons="false"
slider-direction="vertical"
:height="'600px'"
:control-scroll="controlScroll"
/>
</client-only>

Expand Down
9 changes: 7 additions & 2 deletions src/runtime/components/Parts/Slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,14 @@ const handleWheel = (event) => {
}
};
let lastScrollPosition = window.pageYOffset;
let lastScrollPosition = 0;
if(typeof window !== 'undefined') {
lastScrollPosition = window.pageYOffset
}
const handleScroll = () => {
if (!slider.value) return;
if (!slider.value || typeof window === 'undefined') return;
const currentScrollPosition = window.pageYOffset;
const direction = currentScrollPosition > lastScrollPosition ? 'down' : 'up';
Expand Down

0 comments on commit a27503c

Please sign in to comment.