Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
tupic

draggable on touch

Recommended Posts

Dear Community

 

I am new in webdevelopment. So I started my first cordova project.

In the codepen-example you can see my code. It works well on desktop browsers. 

But when I test my code on an mobilephone the img  #main-menue-knob can't get dragged.

Is there any eventlistener that  I have to add, that the drag-function works on a touchevent?

 

Thanks for support

 

Tupic

See the Pen WwejNe by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi tupic,

 

Welcome to the forums! What phone have you tried using? I have given it a try on my Nexus and it worked fine.

 

Draggable is touch enabled by default (see the docs) and should detect it straight out of the box.

 

If we can can pinpoint which device it does not work, we might be able to figure out what is not working.

Link to comment
Share on other sites

Hi Dipscom

 

Thanks for your response.

I'm working with an Samsung Galaxy S5

 

Greetings

Tupic

Link to comment
Share on other sites

I don't have access to a Galaxy S5, unfortunately.

 

Do you see any errors in the console?

Link to comment
Share on other sites

There is no error in the log. The HTML-code as you see it in the codepen example is generated and added dynamically by jQuery. Could this be an issue?

Link to comment
Share on other sites

Hang tight. The CODE-GOD is about to manifest his brilliance and bake us into crisps with this light. 

 

*get your sun protection on*

 

:D

  • Like 2
Link to comment
Share on other sites

what do you want to say with that? I just didn't want to keep back any information that could help to resolve the problem.

Link to comment
Share on other sites

I am saying that someone who knows *a lot* about GASP is looking into this, soon there will be a more detailed response than mine.

 

Be prepared for enlightenment.

Link to comment
Share on other sites

I don't see anything that's obviously wrong from my cursory glance, but I did want to mention:

  1. We don't recommend linking to the "latest" CDN directory because the CDN host stopped supporting that (out of our control) back at version 1.17.0. So your codepen is using stale files. So instead of /latest/, you should link directly to a number like /1.18.2/. So https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js becomes https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.2/TweenMax.min.js
  2. You're not loading ThrowPropsPlugin, so you won't get the smooth continuation of movement when you flick. That's a membership benefit of Club GreenSock but you can use it for free on codepen with this URL: https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/ThrowPropsPlugin.min.js
  3. My understanding is that Cordova is a 3rd party tool that compiles HTML/CSS/JS to native code on phones, thus the problem you ran into very likely has to do with Cordova itself. I'm not familiar with it or its quirks. You might want to contact them. 
  4. I'm pretty confident that Draggable has been used on Samsung Galaxy S* phones without any problem at all. 
  5. Does it work if you remove your alert()? Just curious. 
  • Like 1
Link to comment
Share on other sites

thanks for your answer. Unfortunately it doesnt work...neither with the removed alert.

Link to comment
Share on other sites

Tupic,

 

For the sake of troubleshooting - Are you saying that the CodePen example is not working in the phone? Or is it only when it is in the cordova? (Do bear in mind I have never worked with cordova, so might make very wrong assumptions).

Link to comment
Share on other sites

Ok guys I've found the problem. The Greensock-Plugins work well. It was my rookie-mistake. I tried to initialize the draggable element before it was append to the DOM. Now it works as it supposed to work. Thank you guys for support.

  • Like 1
Link to comment
Share on other sites

Great, thanks for letting us know. Happy tweening (er...dragging)!

  • Like 1
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.
×