Jump to content
GreenSock

Elzean

Startdrag on IOS

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!

 

i have a problem to make the function startDrag(e) to work on IOS. Withinn a mousedown on desktop it's working fine, but on IOS i tried severals events (touchstart, touchmove, ...) passing the event or the event.originalEvent, adding event.preventDefault() or trying stuff like "$(ev.target).trigger('mousedown');", but nothing is working. All the events seems to work fine though, if i put some alert inside i can see them pop in IOS.

 

If i use the normal way with Draggable.create() it's fine too, but in my case i need to use startdrag, the object moved by Draggable.js is not the same object the user press and drag on his screen.

 

I have an example, it's a bit messy but might help to understand my problem (you need to drag the grey area left and right) : http://firelight-creation.com/julien_tonsuso/flip/

 

Thanks !

 

 

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

Have you tried the trigger property of the Draggable tool?.

 

Perhaps I'm understanding this the wrong way(apologies all around if I am), but it seems that you're trying to start the drag by using the touch/mouse event on other element, that's precisely what trigger is for.

 

You can see a couple. This is a very simple one:

 

See the Pen IiHgq by rhernando (@rhernando) on CodePen

 

And this one crafted by Jamie:

 

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

 

Rodrigo.

  • Like 3
Link to comment
Share on other sites

Hey, 

 

thanks a lot, i can't believe i missed that... I was looking at the variables and functions in the doc and didn't check well enough the params.

 

It's now working fine in both ios and desktop :)

 

Thanks again!

  • Like 1
Link to comment
Share on other sites

 i can't believe i missed that...

 

Don't worry, it happens to all of us ;)

 

You're welcome.

 

Happy Tweening!!

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