npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

h5-imageviewer

v0.7.8

Published

Image viewer for mobile browser, supported React/Vue/AngularJS.

Downloads

149

Readme

H5 image viewer

Build Status Coverage Status node npm Maintainability

Image viewer for mobile browser, supported React/Vue/AngularJS.

Features

  • Supported rotate、pinch、move、swipe、scale and double tap gestures.
  • Page turning.
  • Supported landscape and portrait screen.
  • Supported React/Vue/AngularJS.
  • Scroll through long figure.

Demo

QRCODE
Image slider video
Portrait screen video
Landscape screen video

Install

You can install it via npm:

npm i h5-imageviewer

Or get it from CDN:

https://unpkg.com/[email protected]/umd/h5-imageviewer.js

Usage

Show single image viewer

import * as viewer from 'h5-imageviewer'
viewer.showViewer(imgObj, options)
// hide image viewer
viewer.hideImgViewer()

Show image list viewer

import * as viewer from 'h5-imageviewer'
viewer.showImgListViewer(imgObjList, options)
// hide image list viewer
viewer.hideImgListViewer()

Please check EXAMPLE1 or EXAMPLE2 for detail.

Apis

Show single image viewer(viewer.showViewer(imgObj, options))

| Property | Type | Default | Required | Description | | :--------------- | :-----: | :-----: | :------: | :------------------------------------------------------------------------ | | imgObj.src | string | | yes | img src attr (base64 also supported) | | imgObj.alt | string | | no | img alt attr | | options.errorPlh | string | | no | placeholder when image onerror | | options.onViewerHideListener | function() | | no | listener for viewer hide | | options.restDoms | array | | no | | the attach dom array | | options.imgMoveFactor | number | 1.5 | no | movement speed (imgMoveFactor * translateX or translateY) | | options.imgMinScale | number | 1 | no | minimum scale of the image | | options.imgMaxScale | number | 2 | no | maximum scale of the image | | options.zIndex | number | 999 | no | the viewer z-index | | options.viewerBg | string | #000000 | no | the viewer background | | options.clickClosable | boolean | true | no | hide the viewer if click |

Show image list viewer(viewer.showImgListViewer(imgObjList, options))

| Property | Type | Default | Required | Description | | :--------------- | :-----: | :-----: | :------: | :------------------------------------------------------------------------ | | imgObj.src | string | | yes | img src attr (base64 also supported) | | imgObj.alt | string | | no | img alt attr | | options.defaultPageIndex | number | 0 | no | default page index | | options.errorPlh | string | | no | placeholder when image onerror | | options.onViewerHideListener | function() | | no | listener for viewer hide | | options.restDoms | array | | no | | the attach dom array | | options.imgMoveFactor | number | 1.5 | no | movement speed (imgMoveFactor * translateX or translateY) | | options.imgMinScale | number | 1 | no | minimum scale of the image | | options.imgMaxScale | number | 2 | no | maximum scale of the image | | options.zIndex | number | 999 | no | the viewer z-index | | options.viewerBg | string | #000000 | no | the viewer background | | options.onPageChanged | function(pageIndex) | | no | the page changed listener | | options.limit | number | 5 | no | how many pages will be kept offscreen in an idle state | | options.pageThreshold | number | 0.1 | no | threshold of go to next or prev page (window.innerWidth * pageThreshold) | | options.pageDampingFactor | number | 0.9 | no | damping factor | | options.clickClosable | boolean | true | no | hide the viewer if click |

Dependencies

License

This content is released under the MIT License.