Skip to content
Browse files

internally, we only use getScreenHeight during transitions, but it's …

…exposed on $.mobile as well. For a while, it's been returning incorrect values in iOS, as it wasn't taking into account the browser chrome's footer height. window.innerHeight tends to return the value we need more consistently, but it's not supported in older browsers so I've included the jQuery height call as a fallback too.
  • Loading branch information...
1 parent ab6a635 commit aad7df1da1af35176ea54a12edc56087e7b791fd scottjehl committed Mar 20, 2012
Showing with 3 additions and 8 deletions.
  1. +3 −8 js/
11 js/
@@ -508,14 +508,9 @@ define( [
//simply set the active page's minimum height to screen height, depending on orientation
function getScreenHeight(){
- var orientation = $.event.special.orientationchange.orientation(),
- port = orientation === "portrait",
- winMin = port ? 480 : 320,
- screenHeight = port ? screen.availHeight : screen.availWidth,
- winHeight = Math.max( winMin, $( window ).height() ),
- pageMin = Math.min( screenHeight, winHeight );
- return pageMin;
+ // Native innerHeight returns more accurate value for this across platforms,
+ // jQuery version is here as a normalized fallback for platforms like Symbian
+ return window.innerHeight || $( window ).height();
$.mobile.getScreenHeight = getScreenHeight;

1 comment on commit aad7df1

rbdcti commented on aad7df1 Mar 19, 2012

Thank you. I was noticing this issue on IOS with my mobile chat window (the footer would hang half past the page with iOS and I couldn't fix it). This fixed the problem.

Please sign in to comment.
Something went wrong with that request. Please try again.