ch.Viewport
Description
The Viewport is a component to ease viewport management. You can get the dimensions of the viewport and beyond, which can be quite helpful to perform some checks with JavaScript.
Extends
- tiny.EventEmitter
Properties
.bottom
Number
The current bottom client rect of the viewport (in pixels).
.height
Number
The current height of the viewport (in pixels).
.left
Number
The current left client rect of the viewport (in pixels).
.right
Number
The current right client rect of the viewport (in pixels).
.top
Number
The current top client rect of the viewport (in pixels).
.width
Number
The current width of the viewport (in pixels).
Methods
.calculateClientRect() → {viewport}
Calculates/updates the client rects of viewport (in pixels).
.calculateDimensions() → {viewport}
Calculates/updates the dimensions (width and height) of the viewport (in pixels).
.calculateOffset() → {viewport}
Calculates/updates the viewport position.
.calculateOrientation() → {viewport}
Rertuns/updates the viewport orientation: landscape or portrait.
.inViewport() → {Boolean}
Calculates if an element is completely located in the viewport.
.isVisible() → {Boolean}
Calculates if an element is visible in the viewport.
.refresh() → {viewport}
Upadtes the viewport dimension, viewport positions and orietation.