Web APIs are inconsistent in terms of which viewport they refer to, and they're also inconsistent across browsers. A new API exposes the visual viewport as window.visualViewport. It's a draft spec, with cross-browser approval, and it's landing in Chrome 61+. It uses visualViewport to make the top-right of the layout viewport stick to.

5m read timeFrom developers.google.com
Post cover image
Table of contents
Layout viewport vs visual viewportImproving compatibilityExposing the visual viewport to scriptDemoGotchasAccessibility

Sort: