Jump to content
Search Community

Can Draggable detect mobile touch tap events?

ecsancho test
Moderator Tag

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

Thanks for the reply. I'm trying to switch all my jquery mobile touch events (tap, swipe left/right) to Gsap Draggable because jquery feels  unresponsive, like there's a short delay to respond and Gsap feels so much more smoother and responsive. So how would I go about detecting tap and then respond with a function?  Something like Draggable.tap('#button', {}) ?  

Link to comment
Share on other sites

Draggable has both onPress and onClick callbacks. 

 

onPress : Function - a function that should be called as soon as the mouse (or touch) presses down on the element

 

onClick : Function - a function that should be called only when the mouse/touch is pressed on the element and released without moving 3 pixels or more. This makes it easier to discern the user's intent (click or drag). 

 

see docs for more info on both: http://greensock.com/docs/#/HTML5/Drag/Draggable/

 

 

Here is a demo that illustrates the common callbacks

http://codepen.io/GreenSock/full/mJPKNr/

 

Feel free to test on your device.

 

To clarify, Draggable has very robust direction-sensing cababilities built in: http://greensock.com/gsap-1-16 (scroll down for awesome demos) but it does not detect or have callbacks for swipes.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Sure, a lot of effort went into making Draggable work across pretty much all mobile devices meaning it handles touch events on iOS, Android, Windows Phone, etc. Does that answer your question or were you asking something else?

Draggable is definitely fast and I like the demos and documentation. I'm wondering if anybody's created a Cordova/Phonegap app that also includes Draggable yet, possibly something that would fit in with ng+ionic standard.

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.
×
×
  • Create New...