prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.54k stars 639 forks source link

document.viewport.getHeight() off by 60 in iPhone #271

Closed jwestbrook closed 9 years ago

jwestbrook commented 9 years ago

previous lighthouse ticket #1250 by Nick Wing


I didn't see a ticket for this yet, apologies if I missed it.

When I call document.viewport.getHeight() in iPhone and the address bar is scrolled up to where it's hidden from the user, I get the wrong height. I get the height as if the address bar were still fully visible. Since the address bar is (currently) 60 pixels tall in iPhone Safari, the value is too small by 60.

For now I have:

function getViewportHeight() {
  var vph = document.viewport.getHeight();
  return (window.innerHeight - 60 == vph ? window.innerHeight : vph); 
}

This is awfully fragile but I'm at a loss for a better way.

savetheclocktower commented 9 years ago

Only time I've heard about this. Closing until someone else reports or until I get a failing test case.