-
Notifications
You must be signed in to change notification settings - Fork 1
size
Toke Voltelen edited this page Dec 3, 2016
·
4 revisions
Finds the size of a HTML Element or the window.
-
elm
(HTMLElement) - [default=viewport] The HTML element (or window) to find the size of - returns (SizeData) - Object describing the various sizes of an element
SizeData
-
width
(Number) - The total width of the element (with border etc.) -
height
(Number) - The total height of the element (with border etc.) -
innerWidth
(Number) - The width of the elements view area (without border etc.) -
innerHeight
(Number) - The height of the elements view area (without border etc.) -
contentWidth
(Number) - The width of content of the element -
contentHeight
(Number) - The height of content of the element
import size from 'vanillajs-browser-helpers/size';
// The viewport size
size();
// or
size(viewport);
// The window size
size(window);
// A HTML element size
size(element);