jquery mobile - Showing page Loader when rel="external" -
jquery mobile - Showing page Loader when rel="external" -
i navigating external html page in jquery mobile application. page takes while loading want show loader in mean time not working.. here have tried..
$(document).ajaxstart(function() { // $.mobile.loading('show'); $.mobile.loading( "show", { text: 'please wait!', textvisible: 'true', theme: "b", textonly: 'true', html: '' }); }); $(document).ajaxstop(function() { $.mobile.loading('hide'); });
i know rel="external" disables ajax, there there way can show loader opening external links..?
when move external page ajax disabled, loader doesn't show because dom wiped , replaced contents of external page.
the possible way show loader before navigating delay moving page settimeout()
.
html
<a href="http://www.*****.com" rel="external" class="ui-btn external">external page</a>
js
$(document).on("pagecreate", "#pageid", function () { $(".external").on("click", function (e) { e.preventdefault(); var url = $(this).attr("href"); $.mobile.loading("show", { text: "redirecting...", textvisible: true }); settimeout(function () { location.href = url; }, 2000); // 2secs delay }); });
demo - code
jquery-mobile jquery-mobile-loader
Comments
Post a Comment