added minScrollBack feature to core options. This is the minimum scroll distance that will be jumped-to when returning to a page. By default, the distance is screen.height /2. If you really needed to disable scroll memory altogether, this could be set to Infinity. Note that disabling scroll memory altogether is almost never a good idea for usability, but the option is there.

This commit is contained in:
scottjehl 2011-06-17 16:33:19 -04:00
parent 3bd713c185
commit fcbfc2f380
3 changed files with 8 additions and 2 deletions

View file

@ -103,6 +103,9 @@ $(document).bind("mobileinit", function(){
<dt>defaultDialogTransition (<em>string</em>, default: 'pop'):</dt>
<dd>Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions by default.</dd>
<dt>minScrollBack (<em>string</em>, default: 150):</dt>
<dd>Minimum scroll distance that will be remembered when returning to a page. </dd>
<dt>loadingMessage (<em>string</em>, default: "loading"):</dt>
<dd>Set the text that appears when a page is loading. If set to false, the message will not appear at all.</dd>

View file

@ -38,6 +38,9 @@
//set default page transition - 'none' for no transitions
defaultPageTransition: "slide",
//minimum scroll distance that will be remembered when returning to a page
minScrollBack: screen.height / 2,
//set default dialog transition - 'none' for no transitions
defaultDialogTransition: "pop",

View file

@ -396,7 +396,7 @@
}
//if the Y location we're scrolling to is less than 10px, let it go for sake of smoothness
if( toScroll < 20 ){
if( toScroll < $.mobile.minScrollBack ){
toScroll = 0;
}
@ -453,7 +453,7 @@
//simply set the active page's minimum height to screen height, depending on orientation
function resetActivePageHeight(){
var height = jQuery.event.special.orientationchange.orientation() == "portrait" ? screen.height : screen.width,
var height = jQuery.event.special.orientationchange.orientation() === "portrait" ? screen.height : screen.width,
winHeight = $( window ).height(),
pageMin = Math.min( height, winHeight );