Jump to content


pointerEvent not working properly in Android?

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

Hey guys,


I am trying to enable both click and drag on an element inside a Draggable. Thanks to jamie's great solution:

See the Pen Inolp by jamiejefferson (@jamiejefferson) on CodePen

I was able to get things working (minus android)


If you take a look at my fiddle: http://jsfiddle.net/78eDH/


You will notice that the red square both drags and clicks as it should using the trueClick() check.

TrueClick() works great for both desktop, and iOS, but fails in Chrome and Firefox on Android.


trueClick() always returns TRUE on android, whether or not I moved 2 pixels or 200 pixels.


I imagine that chrome and firefox on android are not returning proper values for positionEvent/pageX/pageY?


Any help would be much appreciated. (Even a better way to handle the trueClick).



Link to comment
Share on other sites

Sure, looks like you can fix this by changing the following references:


pointerEvent.pageX to pointerX

pointerEvent.pageY to pointerY


They're updated on mouseMove/touchMove so should always have the latest values in them.


On Android, the pointerEvent was not receiving updated pageX/Y (even though it looks like Draggable is updating that just as often as pointerX/Y). Not sure why that's happening, but pointerX/Y fixes it.

  • Like 4
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.