z-zoomer
is available on npm, published as @benavern/z-zoomer
.
The component is available here on npm, you can install it via this command:
npm i @benavern/z-zoomer
Then you can use it in your scripts like so in your js/ts module files:
import '@benavern/z-zoomer';
<script type="module" src="https://unpkg.com/@benavern/z-zoomer"></script>
For example you can use it to display a slider of images
<z-zoomer>
<img src="https://picsum.photos/960/540?random=1">
</z-zoomer>
Any HTML will work
<z-zoomer>
<p>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Inventore vel recusandae quae accusamus, dolore facilis maxime laboriosam quod provident magni in voluptates unde ex. Eveniet ex a expedita numquam soluta?
</p>
</z-zoomer>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Inventore vel recusandae quae accusamus, dolore facilis maxime laboriosam quod provident magni in voluptates unde ex. Eveniet ex a expedita numquam soluta?
You can set max
zoom attribute to control the max zoom value. (default: 10, min: 1)
You can reset the component by calling the reset public methode.
You can react to zoomchange
events on the component. It will provide the information whether it is zoomed or not.
You can disable any interaction on the zoomer with the disabled
attribute.
For example, in a carousel (z-carousel) you can zoom a picture and prevent the carousel from moving at the same time.