Click events fire twice in iscroll lite! #270

Closed
kevingil opened this Issue Sep 21, 2012 · 7 comments

Projects

None yet

6 participants

@kevingil

Im using iscroll for an android app with a webview and when i click in something the action fires twice.
I tried this
https://groups.google.com/forum/#!topic/iscroll/XL2Ny9gpKc0
but it didnt work. Im running jellybean and I heard some people had problems with it too but I cant find a way to fix it.
ANY HELP???
edit: im using this version of i scroll lite
http://cubiq.org/dropbox/iscroll4/src/iscroll-lite.js?v4
What fires twice are some hyperlinks that open new activities in android

@adjohnson916

Same problem here. Doesn't seem to affect Chrome for Android or iOS Safari. Just the default browser in
Android Jelly Bean 4.1. We were just about to release an app at work too. Help!

@kevingil

in html href="javascript:void(0)" onclick="location.href=(' '); and in xml android:launchMode="singleInstance"

@ibrahimLincoln

I found a fix to this. what was happening is that if I have link inside the iscroll 4 wrapper, on ipad 1, iOS5.1.1 once the new window opens, then when I close it, it triggers the same window again. some issue with iscroll.
if you experience this, the FIX is:

replace the following lines

onBeforeScrollStart: function (e) { e.preventDefault(); },
onScrollStart: null,

with the following

onBeforeScrollStart: function (e) { e.stopImmediatePropagation(); },
onScrollStart: function (e) { e.preventDefault(); },

@zookz
zookz commented Jul 25, 2013

I fixed by the following:

$(selecter).on('touchstart', function(e) {
e.stopPropagation();
});

this will only fire once!

@diyism
diyism commented Oct 28, 2013

I use on('tap',....) instead of onclick to avoid this problem.

@cubiq cubiq added a commit that referenced this issue Oct 29, 2013
@cubiq fix #439 #488 #517 #428 #270 #520 #447 #452 #509 052c5ba
@cubiq
Owner
cubiq commented Oct 29, 2013

I have implemented a pretty aggressive solution to this problem. Please update to the latest version and let me know.

@cubiq cubiq closed this Oct 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment