Jump to content
GreenSock

phidur

Trouble with Draggable startDrag on touchmove of different element

Go to solution Solved by Diaco,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

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 comment
Share on other sites

  • Solution

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 comment
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 comment
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.
×