Viewport
class Viewport
A component that manages viewport size
Constructor
new Viewport(el)
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
|---|---|---|---|---|
| el | HTMLElement | A viewport element |
Properties
element
A viewport(root) element
Type: HTMLElement
width
Viewport width, without paddings
Type: number
height
Viewport height, without paddings
Type: number
padding
Viewport paddings
Type: object
| PROPERTY | TYPE | DESCRIPTION |
|---|---|---|
| left | number | CSS padding-left |
| right | number | CSS padding-right |
| top | number | CSS padding-top |
| bottom | number | CSS padding-bottom |
Methods
setSize
Change viewport's size.
This will change the actual size of .flicking-viewport element by changing its CSS width/height property
| PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
|---|---|---|---|---|
| size | object | ✔️ | New viewport size | |
| size.width | number | string | ✔️ | CSS string or number(in px) | |
| size.height | number | string | ✔️ | CSS string or number(in px) |
resize
Update width/height to the current viewport element's size