Zoom
<msc-zoom /> is a web component which provide zoom-in / zoom-out effects for image closing watch. Users could just tap the part they like to have a closing watch.
Try the following demo and see what can <msc-zoom /> do ?
(scale: 2, duration: 300)
(scale: 3, duration: 500)
Basic Usage
<msc-zoom /> is a web component. All we need to do is put the required script into your HTML document. Then follow <msc-zoom />'s html structure and everything will be all set.
Required Script
Structure
Put img[slot="msc-zoom-vision"] inside <msc-zoom /> as its child. It will use it as source.
JavaScript Instantiation
<msc-zoom /> could also use JavaScript to create DOM element. Here comes some examples.
Style Customization
Developers could apply styles to decorate img[slot="msc-zoom-vision"].
Attributes
<msc-zoom /> supports some attributes to let it become more convenience & useful.
active
Set active for <msc-zoom />. It will zoom-in once set true. Default is false (not set).
duration
Set duration for <msc-zoom /> zoom-in / zoom-out animation. Default is 300 (ms).
scale
Set scale for <msc-zoom />. Default is 2.
Property
| Property Name | Type | Description |
|---|---|---|
active
|
Boolean | Getter / Setter for active. It will turn on / off zoom effects. |
duration
|
Number | Getter / Setter for duration. The zoom animation's duration will apply this value with unit ms. Default is 300. |
scale
|
Number | Getter / Setter for scale. The scale rate will apply this value. Default is 2. |
Event
| Event Signature | Description |
|---|---|
msc-zoom-click
|
Fired when <msc-zoom /> has been clicked. Developers could get mode through event.detail. |