# image-hotspot

> image hotspot for showing feature details in javascript

Latest version **1.1.0** (published 2021-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install image-hotspot
pnpm add image-hotspot
yarn add image-hotspot
bun add image-hotspot
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-08-12 |
| First published | 2021-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 207.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Ashish - https://kumarashish.com |
| Maintainers | ashishkumar.ui |
| Keywords | image-hotspot, js image hotspot |

## Links

- npm: https://www.npmjs.com/package/image-hotspot
- Repository: https://github.com/npm-ashish/image-hotspot
- Homepage: https://npm-ashish.github.io/image-hotspot/
- Issues: https://github.com/npm-ashish/image-hotspot/issues
- npm.io page: https://npm.io/package/image-hotspot

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-08-12
- 1.0.0 — 2021-08-12

## README

# image-hotspot
Image hotspot feature for showing details about specific feature of product

## Installation
`npm i image-hotspot`

## HTML
```HTML
<div class="image-hotspot" data-hotspots='[...]'>
    <img src="./demo/assets/product.jpeg" alt="Product image">
</div>
```

```javascript
import ImageHotspots from 'image-hotspot';

const hotspotElm = document.querySelector('.image-hotspot');
const hotspotInstance = new ImageHotspots(hotspotElm);
```

## Hotspot Data
Hotspot data is is array of below type of objects
```javascript
{
    "name": "touch-control",
    "position": {
        "top": "55%",
        "left": "41%"
    },
    "direction": "up-right",
    "distance": "100px",
    "content": "<h2>Touch controls</h2><p>lorem impsum touch controls</p>"
}
```

## Position
Position is an object with `top` and `left` values in percentage format. This value is used to set the hotspot in image and `top` & `left` are used to set the offset of it from image.

## Directions:

| Direction Name  | Value       |
| ------------- |:-------------:|
| Up left       |  up-left      |
| Up right      |  up-right     |
| Down left     |  down-left    |
| Down right    |  down-right   |
| Left Up       |  left-up      |
| Left down     |  left-down    |
| Right Up      |  right-up     |
| Right down    |  right-down   |

## Distance
Distance is value in pixel and used to set the gap between hotspot and the content for animation while opening it.

## Content
Content is HTML string value.

---
_Source: https://npm.io/package/image-hotspot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
