Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Kári Bertilsson

Draggable lockAxis not working on IOS Safari

Recommended Posts

The codepen is for some reason actually not working on my IOS. But works on android, desktop etc.

 

The issue on IOS is that when dragging the carousel to left or right, the axis is not locked and the page scrolls up/down when only trying to swipe left/right.

See the Pen qBWNEjp by karibertils (@karibertils) on CodePen

Share this post


Link to post
Share on other sites

Hi @Kári Bertilsson :)

 

Welcome to the forum and thanks for joining Club GreenSock.

 

Have you tried:

allowNativeTouchScrolling: false

Does that help?

 

Happy tweening and welcome aboard.

:)

 

  • Like 3

Share this post


Link to post
Share on other sites

Hi @PointC

Thanks for quick reply.

 

Quote

allowNativeTouchScrolling: false

 

This works to disable native touch scroll completely over the element.

But i need the native up/down touch scroll to work unless dragging has started.

Share this post


Link to post
Share on other sites

There seems to be some general weirdness with the overflow-x on iOS. When I test your demo in my iPad, it's just letting the width of the page go out to the full width of the wrapper with all the boxes. I'm no iOS expert, but a Google search showed a few results for overflow-x not being respected. 

 

So for your Draggable question — you want the user to be able to press the draggable element and scroll up/down, but once you start dragging left/right you want that up/down scroll to stop? Is there a reason the user needs to be able to scroll the page up and down by pressing the draggable element? I ask because  allowNativeTouchScrolling: false would work great for this. 

  • Like 3

Share this post


Link to post
Share on other sites

Yes, the carousel fills approx the entire screen height on mobile phones, so with "allowNativeTouchScrolling: false" after the user has scrolled down to the carousel he is effectively stuck there and can't go up/down anymore.

Share this post


Link to post
Share on other sites

I am using Draggable on a React component and managed to get this working correctly on IOS by wrapping the React component in double <NonPassiveTouchTarget /> from https://gist.github.com/xiaody/206c4168f9001671c0a374af4558f582

 

On android the "lockAxis: true" works, but on IOS it does not work unless i use the wrapper also.

 

I would love to get rid of that boilerplate code, so hope this will be fixed in GSAP. I would expect lockAxis to work the same on both platforms.

  • Like 2

Share this post


Link to post
Share on other sites
On 8/24/2019 at 8:26 AM, Kári Bertilsson said:

Are there any plans to make this work correctly out of the box with GSAP ?

I'm so sorry for the tardy reply! We've been heads-down on GSAP 3 and this fell through the cracks. Please accept my apologies.

 

I think the issue may actually be related to some issues in iOS and a workaround could be adding a "touchforcechange" listener to the draggable element. Does this (uncompressed) updated version work any better for you?: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/Draggable-latest-beta.js

Share this post


Link to post
Share on other sites

I'm dealing with the same issue. Setting allowNativeTouchScroll to false on my draggable doesn't seem to work on the latest iOS. And I just tried your Draggable beta, but it doesn't seem to have changed anything on my end. Would love a solution for this! Thanks!

Share this post


Link to post
Share on other sites
14 hours ago, Vic Emond said:

I'm dealing with the same issue. Setting allowNativeTouchScroll to false on my draggable doesn't seem to work on the latest iOS. And I just tried your Draggable beta, but it doesn't seem to have changed anything on my end. Would love a solution for this! Thanks!

Hey @Vic Emond. Did you use allowNativeTouchScrolling (you misspelled it)? If you're still having trouble, please provide a reduced test case so that we can try to replicated it on our end or identify why yours isn't working properly (like a typo ;) ) 

Share this post


Link to post
Share on other sites
20 hours ago, GreenSock said:

Hey @Vic Emond. Did you use allowNativeTouchScrolling (you misspelled it)? If you're still having trouble, please provide a reduced test case so that we can try to replicated it on our end or identify why yours isn't working properly (like a typo ;) ) 

 

Phew...I didn't misspell that property. You had me worried that it was going to be a dumb mistake (although it might be some other dumb mistake).

 

I am using this to create the draggable gallery:

oGallery = Draggable.create( $('.slider div.wrapper'), { type: 'left', edgeResistance: .75, bounds: $('div.slider'), lockAxis: true, dragClickables: true, allowNativeTouchScrolling: true, throwProps: true, snap: { left: function(nEndValue){ return Math.round(nEndValue / nGalleryWidth) * nGalleryWidth } } } );

 

And you can see it in place on my dev site here: http://maw.netingredients.com. On mobile (at least on my iPhone running the latest iOS), the slightest deviation from swiping left to right on the gallery causes the native vertical scrolling to happen. So, in turn, swiping the gallery left or right can be difficult or a little wonky. I was hoping to get this to perform more like how the Instagram app works, for example. You can scroll up and down just fine, even if there are posts with multiple photos that allow you to swipe between them left to right. And when you are swiping left to right, there isn't any conflict with scrolling up and down. I realize that is an app and there is tighter control over event handling, but I was hoping I could make some improvements over what I've currently got.

 

If you need more of a simplified test case to help me identify a solution, I'd be happy to throw one together. Thanks!

Share this post


Link to post
Share on other sites

Yeah, it's tough to troubleshoot a live site like that since we can't tweak values and see what happens, plus there are a bunch of other variables in the mix. 

 

First, are you positive you tried the latest beta, with a hard-refresh? https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/Draggable-latest-beta.js

 

I did a quick test on my iPhone (latest beta) and it seemed to handle the vertical scrolling and the side-swiping perfectly. I'm not sure what else might be interfering in your live site. A reduced test case in codepen would go a long way in helping to identify any issues. 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×