From 612d1be179a846050624130ddd46035e58c587d8 Mon Sep 17 00:00:00 2001 From: Mat Marquis Date: Tue, 6 Dec 2011 14:06:09 -0500 Subject: [PATCH] Added inline loading indicator (a fake delay is set in the AJAX callback). --- css/structure/jquery.mobile.core.css | 4 +++- js/jquery.mobile.fetchlink.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/css/structure/jquery.mobile.core.css b/css/structure/jquery.mobile.core.css index 6f01725f..0994d79c 100644 --- a/css/structure/jquery.mobile.core.css +++ b/css/structure/jquery.mobile.core.css @@ -55,7 +55,9 @@ div.ui-mobile-viewport { overflow-x: hidden; } /* loading screen */ .ui-loading .ui-mobile-viewport { overflow: hidden !important; } .ui-loading .ui-loader { display: block; } -.ui-loading .ui-page { overflow: hidden; } +.ui-loader-inline .ui-icon-loading { display: block; margin: 1em auto; width: 35px; height: 35px; background-color: rgba(0,0,0,.1); } + +.ui-loading .ui-page { overflow: hidden; } .ui-loader { display: none; position: absolute; opacity: .85; z-index: 100; left: 50%; width: 200px; margin-left: -130px; margin-top: -35px; padding: 10px 30px; } .ui-loader h1 { font-size: 15px; text-align: center; } .ui-loader .ui-icon { position: static; display: block; opacity: .9; margin: 0 auto; width: 35px; height: 35px; background-color: transparent; } diff --git a/js/jquery.mobile.fetchlink.js b/js/jquery.mobile.fetchlink.js index f2a1b6db..95477f91 100644 --- a/js/jquery.mobile.fetchlink.js +++ b/js/jquery.mobile.fetchlink.js @@ -9,12 +9,15 @@ $.widget( "mobile.fetchlink", $.mobile.widget, { // Prototyping. // $( this.element.data( 'fragment' ) ).hide(); + console.log( $(":jqmData(role='page')") ); + + $( this.element ).click(function() { var el = $( this ), url = el.attr( 'href' ), target = el.data( "target" ), targetEl = target && $( target ) || el, - load = el.data( "fragment" ) /* Needs a proper default (page, most likely). */, + load = el.data( "fragment" ) || $(":jqmData(role='page')") /* Needs a proper default (page, most likely). */, threshold = screen.width > parseInt( el.data( "breakpoint" ) || 0 ), methods = [ "append", "prepend", "replace", "before", "after" ], method = "html", @@ -60,7 +63,7 @@ $.widget( "mobile.fetchlink", $.mobile.widget, { }); $( document ).bind( "inlineLoader", function( e ){ - $( e.target ).html( "

" ); + $( e.target ).html( "
" ); });