knockout.js - Android phonegap - click event is fired on the next screen -


i'm using phonegap (cordova 2.8), , android 4.2.1, use frame works: knockout, & jquery mobile. app based on http://propertycross.com/jquery-mobile/

i following funny behavior: when clicking on button moves screen #2, if there button in #2 screen @ same location, clicked well...

the solution found wrap code change screen settimeout:

            settimeout(function() {                 application.navigateto(viewmodel);             },600); 

this solve problem slow down app...

this unfortunate since phonegap slow...

thanks.

there 2 things can do:

1) e.stoppropagation(), e.preventdefault()

phopkins describes here: jquery mobile tap event triggered twice

i'll elaborate, major issue me. applies of tap, click, vclick , other events.

your event functions should have stoppropogation() , preventdefault() called, so:

$('#selector').tap(function(e) {     //your code here      e.stoppropagation();     e.preventdefault(); }); 

this helps, however, found still "phantom" click.

2) bind event page, not button.

that way it's not bound next page.

for example, page id='mypage' , button id='mybtn':

$('#mypage').on('tap', '#mybtn', function(e) {     //your code here      e.stoppropagation();     e.preventdefault();  }); 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -