๋ธ๋ผ์ฐ์ ์๋์ฐ์ ๋ทฐํฌํธ ๋๋น๋ก, ์์ง ์คํฌ๋กค๋ฐ๊ฐ ์กด์ฌํ๋ค๋ฉด ํฌํจํฉ๋๋ค.
๊ตฌ๋ฌธ
var intViewportWidth = window.innerWidth;
Value
intViewportWidth stores the window.innerWidth
property value.
The window.innerWidth
property is read only; it has no default value.
์ฐธ๊ณ
innerWidth ๊ฐ์ window, frame, frameset์ด๋ ๋ค๋ฅธ ์๋์ฐ๋ค์ฒ๋ผ ๋ชจ๋ window ํ์์ ๊ฐ์ฒด์์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
There is an algorithm to obtain the width of the viewport excluding, if rendered, the vertical scrollbar.
์์
// ๋ค์๊ณผ ๊ฐ์ด ๋ทฐํฌํธ์ ํญ์ ๋ฐ์์ฌ ์ ์์ต๋๋ค.
var intFrameWidth = window.innerWidth;
// ๋ค์๊ณผ ๊ฐ์ด frameset ์์ ์ด๋ค frame์ ๋ทฐํฌํธ ํญ์ ๋ฐ์์ฌ ์ ์์ต๋๋ค.
var intFrameWidth = self.innerWidth;
// ๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ฅ ๊ฐ๊น์ด frameset์ ๋ทฐํฌํธ ํญ์ ๋ฐ์์ฌ ์ ์์ต๋๋ค.
var intFramesetWidth = parent.innerWidth;
// ๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ฅ ๋ฐ๊นฅ์ชฝ ํ๋ ์์
์ ๋ทฐํฌํธ ํญ์ ๋ฐ์์ฌ ์ ์์ต๋๋ค.
var intOuterFramesetWidth = top.innerWidth;
์๋์ฐ์ ์ฌ์ด์ฆ๋ฅผ ๋ณ๊ฒฝํ๋ ค๋ฉด, window.resizeBy
๋๋ window.resizeTo
๋ฅผ ์ฐธ์กฐํ์ธ์.
๋ช ์ธ
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module The definition of 'window.innerWidth' in that specification. |
Working Draft | Initial definition |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
BCD tables only load in the browser