Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertical scrolling on touch devices causes janky page scroll #41

Closed
Appwerks opened this issue Feb 10, 2015 · 20 comments
Closed

Vertical scrolling on touch devices causes janky page scroll #41

Appwerks opened this issue Feb 10, 2015 · 20 comments

Comments

@Appwerks
Copy link

When vertically scrolling on the flickety object on a touch device, the entire page gets janky. Furthremore, when scrolling downward, the flickity object appears to try to reposition itself upward in the viewport by 20-30 pixels or so. This does not occur when scrolling upward but the page scrolling is still janky.

Setting resize to “false” alleviates its severity but the issue persists.

Touch-scrolling outside the flickity object eliminates the issue and results in a smooth scroll.

@Appwerks
Copy link
Author

The effect can be observed on the flickity project page, especially on the examples lower on the page. It’s less visible on the main/top slider.

The effect appears to be esepcially pronounced on longer pahes where there is (a lot of) content above and below flickity object.

@Appwerks Appwerks changed the title Vertical scrolling on iPad causes janky page scroll Vertical scrolling on tocuh devices causes janky page scroll Feb 10, 2015
@desandro desandro changed the title Vertical scrolling on tocuh devices causes janky page scroll Vertical scrolling on touch devices causes janky page scroll Feb 10, 2015
@desandro
Copy link
Member

Thank you for the feedback! I just tested on iPhone and iPad. I don't think I'm able to reproduce quite the same jankiness as you have described. Indeed, the scrolling behavior on touch devices is faked -- it's not native page scrolling. But I feel it works fairly well.

I'll leave this open in case others are running into the same issue.

@Appwerks
Copy link
Author

Thanks for the quick reply. I took a quick at the code and see that the vertical scrolling, as you said, is indeed “faked” (i.e., the vertical offset is used to mimic vertical scrolling). I wonder if it would be easier, and more native feeling, if, when vertical scroll on touch is detected (touch.delta.Y > touch.delta.X), all flickity actions (swpes, drags, etc.) were stopped/suspended and the flickity object became just another “static” div.

That would result in native scrolling (and added bonus may be elimination of the lateral shifting of slides on vertical touch scroll).

I will look into this in the next few days and see how feasible it is unless there is a quicker/faster way to do this.

@dkdl
Copy link

dkdl commented Feb 12, 2015

I can replicate the issue as well. I'm using flickity for a fullscreen slider and on a iPad Retina and iPhone 6 it's very sluggish. Other sliders like Flexslider or Peppermint doesn't seem to have this problem.

@desandro
Copy link
Member

@dkdl Thanks for chiming in. To be clear, is the vertical scrolling or horizontal scrolling sluggish?

@Appwerks
Copy link
Author

In my case (and I ran a number of scenarios with different settings, flickity dimensions, etc.) page scrolling is supper choppy when I vertically scroll on a flickity object. The whole thing feels like fighting the flickity object’s tendence to shift itself up or down depending on which direction one wants to scoll the page.

@Appwerks
Copy link
Author

For what it’s worth, my first attempt at finding a workaround fixed the vertical page scrolling but stopped the slider from working. Granted, I just focused on the vertical scroll part of the code and took what I thought was the most direct way of accomplsihing it. Will give it another try in the next few days.

@desandro
Copy link
Member

FYI, you can disable vertical scrolling for touch devices with this option.

touchVerticalScroll: false

@dkdl
Copy link

dkdl commented Feb 13, 2015

I tried touchVerticalScroll but now I'm not able to scroll the page anymore because slider is fullscreen.

@desandro I'm only talking about vertical scrolling.

@desandro
Copy link
Member

I'm finding it feels janky on Chrome for iOS

@demark
Copy link

demark commented Mar 4, 2015

Confirm janky page scroll on iPad 2 Safari (iOS 8.1.3). Best approach is: disable slider for vertical scrolling (like Peppermint slider do)

@apsolut
Copy link

apsolut commented Apr 2, 2015

Also i can confirm its janky when i try to scroll website part that have slider, touchVerticalScroll -> disable page scroll totaly when im into section that have slider...

@HarryWiles
Copy link

Definite jank on IOS 8.2, iPhone 5S.
Is there we can disable Flickity during the window scroll event? Or has anyone else found any work arounds for this?

@ricmas
Copy link

ricmas commented Apr 11, 2015

I tested with and without vertical scrollbar on these touch devices:
iPhone4s OS6 / iPad (4th generation) OS 8.1.3

--On iPhone--
The jerky effect occurs also with&without vertical scrollbar with "wrapAround" option enabled.
Same behaviour when swiping or clicking on prev/next, and also with autoplay enabled.
Load the page in portrait mode: jumps when the last element is reached.
Rotate to landscape mode: jumps always.

These are my setting and style added to default (images are all of the same dimensions)
$('.gallery').flickity({
wrapAround: true,
initialIndex:0,
imagesLoaded: true,
touchVerticalScroll: false
});

<style> .gallery-cell { width: 100%; } .gallery img{ display:block; width:100%; } </style>

Same code works well with/without scrollbar on the iPad.

On my notebook I have installed Windows 8.1 TOUCH the only problem caused by vertical scrollbar was the wrong calculation of images width. I did a CSS trick: body { overflow-y: scroll }, adding and removing a class on document ready; I know is not so elegant but solved.

I hope that my tests can help someone, let me know if I can do anything else.

@mgomes
Copy link

mgomes commented Apr 21, 2015

As @HarryWiles mentioned, it'd be great if vertical scroll were to get disabled during a slide event. It'd really tighten this up.

@desandro
Copy link
Member

Flickity v1.0.1 has been released with fixes for touch scrolling. Try it out and holler if this problem persists.

@smartmike
Copy link

❤️

@sashabeep
Copy link

touchVerticalScroll: false
doesn't work on windows phone IE

@w3debugger
Copy link

I'm still facing issue in 2.1.1. Can @desandro please check again?

Thanks 👍

@metafizzy metafizzy locked as resolved and limited conversation to collaborators Nov 10, 2018
@desandro
Copy link
Member

See #740 for janky iOS scrolling.

This thread has been locked as its for an older issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests