-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
swipe* events are not working on Android 4 and Galaxy Nexus unless you suppress touchmove #315
Comments
We don't have a wide range of non iOS devices to test on (I don't have any, for example. @madrobby has a Blackberry Playbook right now). We invite other people to test on their devices, and debug issues that come across. |
Hi Mislav, document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); that line disables the touchmove event ... Probably some device are not able to manage correctly the touchmove event ... |
I can confirm that
as you do in your touch test file. But that disables the scrolling as well. Works in iOS in both cases, though. |
Same problem here on Galaxy S II running ICS using both Android 4 stock browser and Chrome Mobile Beta. |
Change the touch.js module code with: ...
}).bind('touchmove', function(e){
cancelLongTap()
touch.x2 = e.touches[0].pageX
touch.y2 = e.touches[0].pageY
// If touch horizontal then prevents the event and it will suppress scrolling.
if(touch.x2 && Math.abs(touch.x1 - touch.x2) > 10)
e.preventDefault()
}).bind('touchend', function(e){
... It can work well on Galaxy S II running ICS using both Android 4 stock browser and Chrome Mobile Beta. |
I can confirm @itmuse's suggestion works! I'd like to suggest the following tweaks though. if (navigator.userAgent.match(/Android/i) &&
Math.abs(touch.x1 - touch.x2) > 10)
e.preventDefault() Tested on:
There is no need to check for touch.x2 here, because touchmove has surely happend and therefore touch.x2 must have been set. I also added a check so that this fix is only applied to Android (since other devices don't need it) credit to @oklai's as the code used is from his PR #524 related to the same problem. The great thing about @itmuse's fix (with my tweaks) is that it only hinders the ability to scroll (on Android) when the user has shown clear intent to swipe. An Android issue related to this bug has existed since Nov 6, 2009 yet the problem persists - even in their new Chrome browser (source). Fixing this problem through Zepto would -in my opinion- add a lot of value! |
I confirm that @itmuse fix works. Tested on Samsung Galaxy S3 (android v4.0.4) and Samsung Galaxy Note (android v2.3.6). |
I can add that @itmuse fix helps considerably for iPhone5 IOS 6.0.1 also |
@itmuse fix tested and works on Nexus 7. |
Fixed in d945672. Thanks for the patch. |
Guys, don't use the above code, I have used it and got my ass kicked. Took so much time in debugging the issue. Finally by removing it fixed the issue. If you enable that scrolling does not work smooth on long lists. I have tested it on my Devices Samsung Galaxy(4.3) and another 4.3 low end device. In both the devices it broke the scrolling. But it fixed the swipe issue but broke the scrolling. Hope this helps and sorry if I am wrong somewhere. |
@svapreddy |
@songhlc |
Hi,
I have problem with the swipeLeft and swipeRight events with some mobile devices ...
For example with a galaxy s2 and iphone 4 the swipe events function correctly ...
instead, with a galaxy note (android 2.3.4) and a galaxy s the swipe events don't function ...
Could you help me?
Where can i found a list of supported device?
Thanks in advance!
The text was updated successfully, but these errors were encountered: