jquery mobile - Opening dialog programmatically causes pageInit event to fire -
jquery mobile - Opening dialog programmatically causes pageInit event to fire -
i'm opening dialog programmatically piece of code:
$.mobile.changepage('#about', { transition: 'pop', changehash: false }); #about block on same page:
<div id="about" data-role="dialog"> <!-- --> </div> but every time that, pageinit event called, unwanted behavior.
is there way around this?
i'm not sure mean "which unwanted behavior" if want run code 1 time dialog add together check see if has been initialized yet:
$(document).delegate('#about', 'pageinit', function () { if ($(this).hasclass('ui-dialog') === false) { //code in here run 1 time per page load/refresh } }); jquery mobile adds classes each of widgets initializes, can check widgets these classes test if have been initialized yet or not.
jquery-mobile
Comments
Post a Comment