After you import Zoomist into your project, you can initialize it by using Zoomist function.
Zoomist can receive two parameters (zoomistElement
& zoomistOptions
), and returns initialized Zoomist instance.
For example:
After you initialize Zoomist, you can access Zoomist methods and properties from the instance. And you can also get the instance from your zoomistElement
’s zoomist property:
For example:
There are two parameters for class Zoomist:
Parameter | Type | Description |
---|---|---|
zoomistElement | HTMLElement | string | First parameter, Required. HTMLElement or string (CSS Selector) of zoomist container HTML element. |
zoomistOptions | object | Second parameter, Optional. A Object with Zoomist options. |
The second parameter zoomistOptions
is optional, so you can initialize Zoomist simply like:
And Zoomist will set the options to default.
All available options and initial value:
Name | Type | Default | Description |
---|---|---|---|
bounds | boolean | true | Set |
draggable | boolean | true | Set |
wheelable | boolean | true | Set |
pinchable | boolean | true | Set |
minScale | number | 1 | Set minimum scale size. Should be smaller than
|
maxScale | number | 10 | Set maximum scale size. Should be bigger than |
initScale | number | null | null | Set initial scale size. Should be bigger than |
zoomRatio | number | 0.1 | Set the zoom ratio. |
disableDraggingClass | string | 'zoomist-not-draggable' | Elements matched this class will not be dragged. |
disableWheelingClass | string | 'zoomist-not-wheelable' | Elements matched this class will not be zoomed by mouse wheel. |
dragReleaseOnBounds | boolean | false | If set to
|
wheelReleaseOnMinMax | boolean | false | If set to
|
slider | boolean | SliderOptions | The slider tool of Zoomist. | |
zoomer | boolean | ZoomerOptions | The zoom tools of Zoomist. |
For example:
Zoomist provide a simple slider tool for you. You can set option slider
to true
and Zoomist will create a horizontal slider in your zoomistElement
. Or you can use these following options and to customize slider.
All available slider options:
Name | Type | Default | Description |
---|---|---|---|
el | HTMLElement | string | null | null | Receives a |
direction | 'horizontal' | 'vertical' | 'horizontal' | Set your slider horizontal or vertical. |
For example:
To customize slider’s styles, checkout these CSS variables.
Zoomist also provide some zoom tools for you, like: zoom-in button, zoom-out button, reset button. You can set option zoomer
to true
and Zoomist will create those buttons in your zoomistElement
. Or you can use these following options and to customize zoomer.
All available zoomer options:
Name | Type | Default | Description |
---|---|---|---|
el | HTMLElement | string | null | null | Define the container of all zoomer buttons. |
inEl | HTMLElement | string | null | null | Define the zoom-in button. |
outEl | HTMLElement | string | null | null | Define the zoom-out button. |
resetEl | HTMLElement | string | null | null | Define the reset button. |
disabledClass | string | false | null | 'zoomist-zoomer-disabled' | Set the disable class. |
For example:
To customize zoomer’s styles, checkout these CSS variables.