Skip to content

Commit

Permalink
Enable and disable scrolling in touch devices as per user gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-priyanka-g committed Oct 12, 2023
1 parent 93b8c41 commit 96861bf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
:speed="700"
:mousewheel="false"
:modules="modules"
:allowTouchMove="false"
class="swiper-container tw-h-screen"
@swiper="setSwiperRef"
@slideChange="onSlideChange"
Expand Down Expand Up @@ -314,9 +315,10 @@ export default {
let scrollTop = window.scrollY;
if (window.pageYOffset >= stickyTop) {
this.swiperRef.mousewheel.enable();
console.log("enablemousewheel", this.swiperRef.mousewheel.enable());
this.swiperRef.allowTouchMove = true;
} else {
console.log("disablemousewheel", this.swiperRef.mousewheel.disable());
this.swiperRef.mousewheel.disable();
this.swiperRef.allowTouchMove = false;
}
this.lastScrollY = scrollTop;
},
Expand Down

0 comments on commit 96861bf

Please sign in to comment.