From a27503c1344700ac2de7e381b9936710407c5c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=93=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=BA=D0=B8=D0=BD?= Date: Tue, 20 Feb 2024 12:13:46 +0600 Subject: [PATCH] fix slider --- src/runtime/components/Pages/TestVuetify.vue | 1 + src/runtime/components/Parts/Slider.vue | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/runtime/components/Pages/TestVuetify.vue b/src/runtime/components/Pages/TestVuetify.vue index da79d1d..ad4dd9e 100644 --- a/src/runtime/components/Pages/TestVuetify.vue +++ b/src/runtime/components/Pages/TestVuetify.vue @@ -11,6 +11,7 @@ :show-buttons="false" slider-direction="vertical" :height="'600px'" + :control-scroll="controlScroll" /> diff --git a/src/runtime/components/Parts/Slider.vue b/src/runtime/components/Parts/Slider.vue index 1e0fb72..5858c07 100644 --- a/src/runtime/components/Parts/Slider.vue +++ b/src/runtime/components/Parts/Slider.vue @@ -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';