get-image-pos
v0.0.11
Published
Get image position coordinates
Downloads
217
Maintainers
Readme
Get image position coordinates
Documentation: https://antonbobrov.github.io/get-image-pos/
How to start with NPM
npm install get-image-pos
How to start with CDN
<script src="https://cdn.jsdelivr.net/npm/get-image-pos/dist/cdn/index.min.js"></script>
Example
import { getPos, applyHTMLPos } from 'get-image-pos';
// for CDN:
// window.getImagePos
const image = document.querySelector("img");
const pos = getPos({
source: image,
rule: 'cover',
container: image.parentElement,
});
applyHTMLPos({
source: image,
rule: 'cover',
container: image.parentElement,
});