get-image-pos
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

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,
});

Package Sidebar

Install

npm i get-image-pos

Weekly Downloads

52

Version

0.0.11

License

MIT

Unpacked Size

306 kB

Total Files

39

Last publish

Collaborators

  • anton.bobrov