Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile support #39

Open
leanneyee opened this issue Jan 13, 2016 · 5 comments
Open

Mobile support #39

leanneyee opened this issue Jan 13, 2016 · 5 comments

Comments

@leanneyee
Copy link

Thanks for this great lightweight table sorting library! Unfortunately it doesn't seem to work properly on a mobile device. Tapping on any of the headers on an Android device or iPhone causes the table to reorder for a second and then snap back to the default (although the icon/class continues to indicate the table is supposedly sorted).

@adamzap
Copy link

adamzap commented Jan 17, 2016

I was having this issue as well, and removing the explicit mobile event support fixed it for me.

Here are the lines to remove:

I don't fully understand the issue, but this seemed like an adequate fix for now.

@pipiscrew
Copy link

@adamzap ;)

@annetters
Copy link

annetters commented Sep 7, 2017

Chiming in that this issue is still occurring in the latest release, as @leanneyee has described in 2016. If you hold down the mobile screen with your finger, it sorts, but as soon as you let it go it snaps back. I am testing in Android Chrome.

@adamzap's solution didn't work for me, but thank you anyway.

A similar issue has been reported here: #46

@stri8ed
Copy link

stri8ed commented Jul 8, 2019

As described by @adamzap, issue is caused by binding to both ontouchstart and onclick, so effectively each click is triggered twice, resulting in a sort/reverse-sort sequence. Can also fix this by returning false from the onClick() function.

@rudolf-bauer
Copy link

Thanks a lot @adamzap.

If you are using the minified version, just uncomment this in your sortable.min.js:
f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),

E.g. like that:
/*f="ontouchstart"in document.documentElement,f&&c.push("touchstart"),*/

ztaira pushed a commit to ztaira/sortable that referenced this issue Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants