Jump to content
Search Community

Draggable elementsFromPoint on Mobile error

KikeFront 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

Hi all, i get this error on the console ON MOBILE getting document.elementsFromPoint(posX, posY). On Chrome on desktop it works nice :(

 

Quote

Uncaught TypeError: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite.
    at Ta.onDrag ((index):48)
    at ja (Draggable.min.js:14)
    at Array.db (Draggable.min.js:14)
    at Object.O (Draggable.min.js:14)
    at Object.i.dispatchEvent (TweenMax.min.js:16)
    at s (TweenMax.min.js:16)

 

 

My code:

Quote
let dragItem = Draggable.create(".drag", {
type: "x,y",
bounds: ".configurator",
onDrag: function(event) {
// TODO: On Mobile document.elementsFromPoint causes ERROR.
posX = parseInt(event.clientX);
posY = parseInt(event.clientY);
overElement = document.elementsFromPoint(posX, posY);
}
});

 

I have the example with the error on jsfiddle:

http://jsfiddle.net/equerol/92j45hd0/21/

 

 

See the Pen 21 by equerol (@equerol) on CodePen

Link to comment
Share on other sites

56 minutes ago, KikeFront said:

Hi all, i get this error on the console ON MOBILE getting document.elementsFromPoint(posX, posY). On Chrome on desktop it works nice :(

 

Did you check the event and what you're passing into .elementsFromPoint()? event.clientX and event.clientY are undefined on touch events. Please check the documentation for .pointerX and .pointerY properties.

https://greensock.com/docs/Utilities/Draggable

 

See the Pen XopZRP by osublake (@osublake) on CodePen

 

 

 

 

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

On 12/20/2018 at 1:55 PM, OSUblake said:

 

Did you check the event and what you're passing into .elementsFromPoint()? event.clientX and event.clientY are undefined on touch events. Please check the documentation for .pointerX and .pointerY properties.

https://greensock.com/docs/Utilities/Draggable

 

See the Pen XopZRP by osublake (@osublake) on CodePen

 

 

Thank you !! Your example help me a lot.

 

 

 

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