Single image viewer.
https://luna.liriliri.io/?path=/story/image-viewer
Add the following script and style to your page.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-image-viewer/luna-image-viewer.css" />
<script src="//cdn.jsdelivr.net/npm/luna-image-viewer/luna-image-viewer.js"></script>
You can also get it on npm.
npm install luna-image-viewer --save
import 'luna-image-viewer/luna-image-viewer.css'
import LunaImageViewer from 'luna-image-viewer'
const imageViewer = new LunaImageViewer(container, {
image: 'https://luna.liriliri.io/pic1.png',
})
imageViewer.zoom(0.1)
- image(string): Image src.
- initialCoverage(number): Initial coverage.
- zoomOnWheel(boolean): Enable to zoom the image by mouse wheel.
Reset image to initial state.
Rotate image with a relative degree.
Rotate image to an absolute degree.
Zoom image with a relative ratio.
Zoom image to an absolute ratio.
- x(number): Pivot point x.
- y(number): Pivot point y.