javascript - Pageshow in JQM adds new page without removing old ones -
i have issue webpage. think problem: jqm - "pageshow" event firing number of times on page visit
each time go , go page (with pageshow) loads 1 time again (as want) seems if have 2 pages or more if go in 3, 4 or more times. each time press button send info server executes many times (as much times go out , in webpage)
i need reload whole page each time go within can't utilize 1 instead on:
$(document).on("pageshow", '#activity', function() { i tried with:
$(document).off("pageshow", '#activity').on("pageshow", '#activity', function() { but seems not work.
is there way eliminate webpage each time go out? want have 1 copy
to add together bindings / attach listeners such click, change, etc, should placed within pagecreate event fires 1 time per page. event equivalent .ready().
$(document).on("pagecreate", '#activity', function() { /* listeners */ $("#foo").on("change", function () { $.ajax(); }); }); use pageshow/pagecontainershow , events similar it, manipulate dom or execute other functions.
jqm 1.3
$(document).on("pageshow", '#activity', function() { /* manipulate dom */ $("#foo").removeclass("bar"); /* run functions */ $.dosomething(); }); jqm 1.4
$(document).on("pagecontainershow", function(e, data) { if(data.topage[0].id == "activity") { /* manipulate dom */ $("#foo", data.topage).removeclass("bar"); /* run functions */ $.dosomething(); } }); javascript jquery-mobile
No comments:
Post a Comment