Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit cfd13ad

Browse files
committed
when the loader is below the screen height move it up, also unbind the checkLoaderPosition to speed up scrolling
1 parent f73c010 commit cfd13ad

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

js/jquery.mobile.init.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
5252
// check position of loader to see if it appears to be "fixed" to center
5353
// if not, use abs positioning
5454
function checkLoaderPosition(){
55-
if( $loader.offset().top < $window.scrollTop() ){
55+
var offset = $loader.offset(),
56+
scrollTop = $window.scrollTop(),
57+
htmlHeight = $html.height();
58+
59+
if( offset.top < scrollTop || (offset.top - scrollTop) > htmlHeight ) {
5660
$loader.addClass( "ui-loader-fakefix" );
5761
fakeFixLoader();
5862
$window
@@ -97,6 +101,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
97101
}
98102

99103
$( window ).unbind( "scroll", fakeFixLoader );
104+
$( window ).unbind( "scroll", checkLoaderPosition );
100105
},
101106

102107
// find and enhance the pages in the dom and transition to the first page.

0 commit comments

Comments
 (0)