html-FloatingPreviewImg
Show a floating image for small image preview
Preview
Get
1. Directly use dist/FloatingPreviewImg.js
Just load FloatingPreviewImg.js by script tag and the FloatingPreviewImg
is the class object.
2. Install from npm
npm i floatingpreviewimg
Then in your javascript code
import FloatingPreviewImg from 'floatingpreviewimg'
Usage
new FloatingPreviewImg({
id:'12345',
targetSize:500,
maxSize:500,
minScale:1,
marign:20,
sourceInfoFunc(ele){
return {
width:ele.width,
height:ele.height,
src:ele.src,
highResSrc:highResolutionImageUSrc||undefined,
};
},
shouldShow(target){
let target=e.target;
if(target.localName==='img'
&& target.hasAttribute('showPreview')){
return el;
}
return;
},
});