Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
phidur

Trouble with Draggable startDrag on touchmove of different element

Recommended Posts

Hi all, I've been using GSAP for a while now and frequently browse the forums for advice/tips. The GSAP team makes amazing products and I couldn't be happier with them. Thanks for all the great work!

 

Recently I've been having a lot of fun with the Draggable utility, but just ran in to a couple of problems today within the Chrome browser on Android. 

 

I would like to start dragging my Draggable when a separate "anchor" element outside of the Draggable is dragged (touchmove'd) left or right. Kind of like a "hotspot" to start the dragging action. For reasons unknown to me, the following codepen does not work properly. However, if I change all "touchmove" listeners to "mousedown" listeners, the codepen behaves as expected when using a mouse.

 

Full disclosure: it's actually a different issue I was trying to resolve regarding the way Chrome handles touch events vs pointer events when I ran into this little stumbling block. I'm sure that my issue here is something small/silly. Thanks!

See the Pen NbeYWX by phidur (@phidur) on CodePen

Link to post
Share on other sites

Hi phidur :)

 

if I understand correctly what are you trying to achieve, you can simply use draggable trigger property;

 

pls check this out: 

See the Pen GNParR by MAW (@MAW) on CodePen

  • Like 5
Link to post
Share on other sites

Hi @Diaco, thanks for the reply! That does the trick and was there in the documentation all along - cheers!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×