What is viewport in HTML.

The viewport is the part of the webpage that the user can currently see. The scrollbars move the viewport to show other parts of the page.

Follow this article’s instructions to get the viewport dimensions in Javascript.

if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }

Leave a Comment