fengyuanchen / vue-carousel

Carousel component for Vue.js.
https://fengyuanchen.github.io/vue-carousel/
MIT License
188 stars 34 forks source link

Not supported scroll up/down on mobile #4

Closed nghienngo closed 5 years ago

nghienngo commented 5 years ago

Hi, fengyuanchen Vue-carousel is not supported scroll up/down on mobile. You can help me fix this issue or suggest ways fix this issue? Thanks,

fengyuanchen commented 5 years ago

You should touch outside the carousel area if you want to scroll the page.

nghienngo commented 5 years ago

I use the carousel full screen when responsive on mobile. So, I can't touch outside the area.

fengyuanchen commented 5 years ago

Not support your case right now.

fengyuanchen commented 5 years ago

As of v1.0.0, you can set the slideOnSwipe prop to false to allow page scrolling.

thedark1233 commented 5 years ago

Hello, even in last version slideOnSwipe prop to false didn't worked for me, In case someone is in the same situation and want it to be scrollable for mobile browser I fixed it by adding a class to the carousel component and set touch-action: unset!important;

MrTheSoulz commented 5 years ago

im having the same issue, adding slideOnSwipe does not fix it.

Ive managed to fix it using this script:

<script>
        let lastY;
        $(document).bind('touchmove', function (e) {
            let currentY = e.touches[0].clientY;
            if (currentY !== lastY) {
                $('.carousel').addClass('allowSlide');
            } else {
                $('.carousel').removeClass('allowSlide');
            }
            lastY = currentY;
        });
    </script>

and this scss:

.carousel {
  &.allowSlide {
    touch-action: unset !important;
  }
}