cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.81k forks source link

Problem with Android 4.3.3 #729

Open sebastianzillessen opened 10 years ago

sebastianzillessen commented 10 years ago

Hello,

I use iScroll 4 in one of my cordova 3.2 applications together with AngularJS 1.2. and ngTouch. I updated two days ago to Android 4.4.3 (on my Nexus 4).

Since then, all the click events in my iScroll lists are not working properly anymore. I can click them but they do not react on it, only after 10-20 tries it works sometimes.

Do you have any ideas how to fix this or where it could come from?

Thank you!

cubiq commented 10 years ago

which was the previous version?

sebastianzillessen commented 10 years ago

My previous android version? It was 4.4.2 (sorry I had a spelling mistake in the post above, I upgraded to 4.4.3).

cubiq commented 10 years ago

do you have a demo page? or does it do the same with one of the iscroll demos?

sebastianzillessen commented 10 years ago

Yes I have one: http://goo.gl/6NMYy0. If I open it on the browser, I can click the "click-me" link and get a alert. On Android 4.0.4 ( Samsug GT-S7562) it works as well. But on Android 4.4.3 (Nexus 4) it does not work.

cubiq commented 10 years ago

can you try the click:true option? Also I would need your full user agent

sebastianzillessen commented 10 years ago

Ohh wow. With click:true it is working. But I never had this before... And it is still working for older Android Phones and iOS.

My user agent is

Mozilla/5.0 (Linux; Android 4.4.3; Nexus 4 Build/KTU84L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36
cubiq commented 10 years ago

it's really hard to keep up with all Android versions...

sebastianzillessen commented 10 years ago

Yes, as a app developer i know that ;)

The click:true fixes this issue, so I close it! Thanks!

sebastianzillessen commented 10 years ago

Ok I have to say, that unfortunately it is not working. I get a lot of ghost clicks like described in #742. So probably this is really connected. Has anyone any ideas?

TNT-RoX commented 10 years ago

@cubiq This is a new issue with android, and is solved by binding touchcancel to touchend. what happens is when the touch travels off the element a touchcancel is fired and touchend is never fired. For the other android touchevent issues I have a shim here: https://github.com/TNT-RoX/android-swipe-shim

cubiq commented 10 years ago

touchcancel is already bound to touchend. have to check on this

sureshpattu commented 10 years ago

HI All, I am also facing the same problem, Below android version 4.x its working fine but android version 4.2 - 4.4 its not working I am using IScroll5 and fast-click and script looks like this myScroll = new IScroll('#wrapper', { useTransform: false, useTransition: false, bounce: false, keyBindings: true, click: true, onScrollStart: function (e) { e.preventDefault(); }, onBeforeScrollStart: function (e) { var target = e.target; while (target.nodeType != 1) target = target.parentNode; if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA' && target.tagName != 'BUTTON' && target.tagName != 'A') e.preventDefault(); } }); Can any one help me to fix this. @cubiq

borhub commented 10 years ago

I can confirm that the clicks in sebastianzillessen's demo don't work for me on Android 4.4.4 both Stock Browser (from Cyanogenmod11) and Chrome 36

TNT-RoX commented 10 years ago

This is probably a pixel density issue. Try and divide you minimum thresholds by the devicePixelRatio. Something like: absDistX < Math.Round( 10 / window.devicePixelRatio)

sebastianzillessen commented 10 years ago

Have you succeeded to fix it with that lines of code? Where did you put that @TNT-RoX ?

sebastianzillessen commented 10 years ago

?

tasosno1 commented 9 years ago

What you need is vclick which is a simulated mouse click for mobile devices. If normal clicks don't work then vclick surely will, as i had the same issue on android.

Unfortunately vclick is only available on JQuery mobile but there maybe something similar like fastclick or other.

The other thing you can try is adding the Hammer Js plugging, not for handling swipes but just for initializing it for the pages you have issues with. This may sort the page out on the device to handle the difference between touch and clicks. I used hammer js together with JQM just for the click issue on Android device and sorted the problem.