Loading spinner relative to jQuery mobile dialog -
is possible have loading spinner, called $.mobile.loading
, within jquery mobile dialog, , have position relative dialog?
it's not possible directly, in hacky way :
on
pageinit
of dialog, clone<div/>
.ui-loader
class.var loader = $(".ui-loader").clone();
then add our dialog, :
$page.find('[data-role="content"]').html(loader); //$page dialog
create class called
.ui-loader-altered
, addposition:relative
it. add class loader inside dialog. make loader stay within dialog.$page.find(".ui-loader").addclass("ui-loader-altered");
now you've got dialog, why dont show up?
$page.find(".ui-loader-altered").show();
full code :
$(document).on("pageinit", "#second", function () { $page = $(this); $(this).on("click", "#show", function () { //clone var loader = $(".ui-loader").clone(); //add dialog $page.find('[data-role="content"]').html(loader); //add class makes dialog position relative div $page.find(".ui-loader").addclass("ui-loader-altered"); //show $page.find(".ui-loader-altered").show(); }) });
Comments
Post a Comment