From d3077b491c5296ee616d7deb4fe2a5a4dd1364ac Mon Sep 17 00:00:00 2001 From: Jesse Streb Date: Wed, 26 Jan 2011 21:08:42 -0500 Subject: [PATCH] [455] Am now setting the min-height of a page so that the address bar can always be hidden on a silent scroll. This helps our transitions feel smoother as the page does not jump down if the page is not taller then 100% of the window. On orientation change we also update this value. --- js/jquery.mobile.media.js | 8 ++++++++ js/jquery.mobile.page.js | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/js/jquery.mobile.media.js b/js/jquery.mobile.media.js index 7c0dbde0..c1762643 100644 --- a/js/jquery.mobile.media.js +++ b/js/jquery.mobile.media.js @@ -105,6 +105,14 @@ $(document).bind("mobileinit.htmlclass", function(){ //add orientation class to HTML element on flip/resize. if(event.orientation){ $html.removeClass( "portrait landscape" ).addClass( event.orientation ); + //Set the min-height to the size of the fullscreen. This is to fix issue #455 + if( event.orientation === 'portrait' ) { + $( '.ui-page' ).css( 'minHeight', ( screen.availHeight >= screen.availWidth ) ? screen.availHeight : screen.availWidth); + } else { + $( '.ui-page' ).css( 'minHeight', ( screen.availHeight <= screen.availWidth ) ? screen.availHeight : screen.availWidth); + } + + $.mobile.silentScroll(); } //add classes to HTML element for min/max breakpoints detectResolutionBreakpoints(); diff --git a/js/jquery.mobile.page.js b/js/jquery.mobile.page.js index 6afa07ed..74d6548c 100644 --- a/js/jquery.mobile.page.js +++ b/js/jquery.mobile.page.js @@ -37,6 +37,12 @@ $.widget( "mobile.page", $.mobile.widget, { if ( this._trigger( "beforeCreate" ) === false ) { return; } + + if( $( "html" ).hasClass( 'portrait' ) ) { + $elem.css( 'minHeight', ( screen.availHeight >= screen.availWidth ) ? screen.availHeight : screen.availWidth); + } else { + $elem.css( 'minHeight', ( screen.availHeight <= screen.availWidth ) ? screen.availHeight : screen.availWidth); + } //some of the form elements currently rely on the presence of ui-page and ui-content // classes so we'll handle page and content roles outside of the main role processing