# view-bigimg

> purejs image viewer

Latest version **1.0.7** (published 2018-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install view-bigimg
pnpm add view-bigimg
yarn add view-bigimg
bun add view-bigimg
```

## 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.0.7 |
| Published | 2018-07-10 |
| First published | 2018-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 31.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | newming |
| Maintainers | newming |
| Keywords | imageviewer |

## Links

- npm: https://www.npmjs.com/package/view-bigimg
- Repository: https://github.com/newming/view-bigimg
- Homepage: https://github.com/newming/view-bigimg#readme
- Issues: https://github.com/newming/view-bigimg/issues
- npm.io page: https://npm.io/package/view-bigimg

## 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.0.7 (latest) — 2018-07-10
- 1.0.6 — 2018-06-15
- 1.0.5 — 2018-06-14
- 1.0.4 — 2018-06-14
- 1.0.3 — 2018-06-14
- 1.0.2 — 2018-06-11
- 1.0.1 — 2018-06-10
- 1.0.0 — 2018-06-10

## README

# view-bigimg

a pure library for zooming and panning your web images

[demo](http://newming.cn/view-bigimg/demo/)

## Features

- Support touch devices
- Smooth dragging and panning images
- Pinch in / Pinch out to zoom in/ zoom out

## How to use

#### A. with inline script

```html
<link rel="stylesheet" href="view-bigimg.css">
<script src="view-bigimg.js"></script>
<script>
  var viewer = new ViewBigimg()

  var wrap = document.getElementById('wrap')
  wrap.onclick = function (e) {
    if (e.target.nodeName === 'IMG') {
      viewer.show(e.target.src.replace('.jpg', '-big.jpg'))
    }
  }
</script>
```

#### B. with npm

```bash
npm i view-bigimg
```

```js
import 'view-bigimg/lib/view-bigimg.css'
import ViewBigimg from 'view-bigimg'

var viewer = new ViewBigimg
viewer.show(imgsrc)
```

## API

- new ViewBigimg(options)
  - show(imgsrc)
  - destroy()

### new ViewBigimg(options)

Creates an instance of ViewBigimg

| Param | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| options | Object | {} | options |
| options.zoomValue | Number | 100 | default zoom size |
| options.maxZoom | Number | 500 | maxium zoom size |
| options.refreshOnResize | Boolean | true | whether refresh when window resize, default is true |
| options.zoomOnMouseWheel | Boolean | true | enable mousewheel to zoom images |

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