Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Touch Events Not Working #54

Open
ben-sykes opened this issue Jul 14, 2014 · 9 comments
Open

Touch Events Not Working #54

ben-sykes opened this issue Jul 14, 2014 · 9 comments
Milestone

Comments

@ben-sykes
Copy link

Seems there is an issue with pulling 'clientX' from the captured events. I believe event.touches[0].clientX is not being captured, or not being accounted for properly.

Please see OnMove (Line 1419) and OnStart (Line 1623) functions.
(Angular-slider.js --Version 0.3.2)

  • No jQuery library, using angular's JQLite.
  • Yes, I have ngTouch as a dependency.
  • No, I'm not doing anything extreme with the slider. Pretty much cut and paste the single bubble slider.

If I add " || event.touches[0].clientX; " to that line, the sliding works, but throws an error (probably just needs some additional checks)

Has anyone else experienced this issue? Or hopefully I just overlooked something simple.. I'll try to throw a punkr together this evening.

@ben-sykes
Copy link
Author

http://plnkr.co/edit/HNusw03NPBOxg4hDgh50

Edit: Of course, view this either in Chome emulator or on your phone...

@ben-sykes
Copy link
Author

Please, could anyone else at least test this quickly to let me know this isn't just a problem with how I'm using it..?

@wisdom2014
Copy link

I have the same problem, the slider is not responding to touch events. I hope this will be fixed soon because this slider works quite good on desktop with mouse.

@ben-sykes
Copy link
Author

Try adding the extra condition " || event.touches[0].clientX; " to the following lines:

  • OnMove (Line 1419)
  • OnStart (Line 1623)

For me, this fixes the complete functionality loss but throws an error in the console (due to me not checking everything completely I'm sure). Its not a showstopping error so I haven't devoted any more of my own time to it... yet. Was hoping this guy actually maintained his projects.

@dasblitz
Copy link

Tnx, I just added this but instead used event.changedTouches[0].clientX can't see any errors. Strange that this fix is needed though, since the events should be coming from $swipe which should have an x value

@ben-sykes
Copy link
Author

Thank you so much for your response! Seems as though I was just pointing to the incorrect event.
You're exactly right though about $swipe. It is odd.

@ejensler
Copy link

+1 to @dasblitz's fix. I had wanted to include this slider in my project for months, and ended up going with a far inferior html-5 range input. I'm not experienced enough with touch events to have debugged this issue myself, so many thanks.

@ejensler
Copy link

It's also important to note that if your project uses jQuery, jQuery appears to wrap touch events, so instead of event.changedTouches[0].clientX, it should be event.originalEvent.changedTouches[0].clientX.

@drgould drgould added this to the v1.0 milestone Sep 4, 2014
@Litande
Copy link

Litande commented Aug 5, 2015

kinda new to this, @dasblitz note about event.originalEvent.changedTouches[0].clientX return the right position of the touch event, the errors where thrown on "touchend" event which has no touches, i solved this by removing the calles to OnMove inside bindSwipe function Line 1755 and bindSlider Line 1685,
does anyone see any critical error in this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants