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 :

  1. on pageinit of dialog, clone <div/> .ui-loader class.

    var loader = $(".ui-loader").clone(); 
  2. then add our dialog, :

    $page.find('[data-role="content"]').html(loader); //$page dialog 
  3. create class called .ui-loader-altered , add position:relative it. add class loader inside dialog. make loader stay within dialog.

    $page.find(".ui-loader").addclass("ui-loader-altered"); 
  4. 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();     })  }); 

demo : http://jsfiddle.net/hungerpain/p2xjt/3/


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -