In Phonegap + IOS button click event fire multiple times using iScroll 4
Asked Answered
I

1

6

I am using iScroll v4 in Phonegap 2.1.0 + IOS. I have a two iscroll in two different pages.

First iscroll

function locationload() {
    locationScroll = new iScroll('locationWrapper', {
        vScrollbar: false,
        hScrollbar: false,
        hScroll: false
    });   
}

Second iscroll

function preferenceload() {
    preferencesScroll = new iScroll('preferencesWrapper', {
        vScrollbar: false,
        hScrollbar: false,
        hScroll: false
    });
}

In first page iScroll worked fine. Second page iScroll also worked fine. but when i click a button in second page, button click event fire multiple times. If i remove the iScroll in second page, button click event works fine. I am using $.mobile.changePage("#Page2", null, true, true); to navigate to Page2.

I can't find any solution anywhere so I am hoping someone here can throw me some ideas.

Thanks

Invective answered 13/12, 2012 at 11:45 Comment(5)
are you using jQuery Mobile?Brame
there are lots of questions about this related to JQM - from what I have experienced, they way to do this is $('element').unbind("click").click( function() { //click code });Brame
@Brame Yes I use jQuery Mobile.Invective
With what @Brame said, try to destroy the iScroll after navigation away from the view.Zarger
I have similar problem trying to use jQM tap, unbinding, trying to stop propagation and even using other JS libraries like hammer.js. so far nothing work and investing time researching people face similar problems and from what other says it is a very old bug even present in the latest jQM versions.Personify
L
0

I think you should try jquery-mobile-iscrollview

Lindsley answered 6/1, 2014 at 1:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.