掘金 图片查看插件。
npm i -S juejin-image-viewer
import JuejinImageViewer from 'juejin-image-viewer'
const imageViewer = new JuejinImageViewer(...)
<script src="path/to/juejin-image-viewer.min.js"></script>
var imageViewer = new JuejinImageViewer(...)
new JuejinImageViewer(container || containerList || selector, {
targetFilter: elem => elem.nodeName === 'IMG' && elem.naturalWidth,
urlGetter: elem => elem.getAttribute('src'),
urlHandler: url => url,
eventName: 'click',
containerClassName: 'juejin-image-viewer__container',
boxClassName: 'juejin-image-viewer__box',
imageClassName: 'juejin-image-viewer__image',
cursor: 'zoom-in',
backgroundColor: '#fff',
transitionDuration: 200,
margin: 0,
parent: null
})
imageViewer.hide()
imageViewer.destroy()