screen width vs visible portion

前端 未结 3 1180
南笙
南笙 2020-12-06 06:58

I have a little problem with JavaScript, to get the screen width we use screen.width which returns the overall screen resolution, is there a command to get the resolution of

3条回答
  •  盖世英雄少女心
    2020-12-06 07:29

    The area you're describing is the viewport, and can typically be accessed by using window.innerWidth or window.innerHeight in modern browsers. IE6 is a bit different, but more information on handling the viewport width for all browsers can be found in this tutorial on obtaining viewport size.

提交回复
热议问题