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

Commit baa5c6d

Browse files
committed
fix for scrolling the window when the user has already started scrolling - apparent when slow download and user is ahead of content or when jQM is being used on desktop platform - ref http://remysharp.com/doing-it-right-skipping-the-iphone-url-bar/
1 parent c4f8e7d commit baa5c6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

js/jquery.mobile.init.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@
111111
//then check what the scroll top is. Android will report 0... others 1
112112
//note that this initial scroll won't hide the address bar. It's just for the check.
113113
$(function(){
114-
window.scrollTo( 0, 1 );
114+
//don't scroll if the user has already scrolled the device, particularly visible when jQM
115+
//being used on a desktop browser
116+
if (!window.pageYOffset) window.scrollTo( 0, 1 );
115117

116118
//if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
117119
//it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)

0 commit comments

Comments
 (0)