# viewer-js **Repository Path**: mirrors/viewer-js ## Basic Information - **Project Name**: viewer-js - **Description**: Viewer 是一款强大的 jQuery 图像浏览插件 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/viewer-js - **GVP Project**: No ## Statistics - **Stars**: 11 - **Forks**: 3 - **Created**: 2020-06-23 - **Last Updated**: 2025-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Viewer [![Build Status](https://img.shields.io/travis/fengyuanchen/viewer.svg)](https://travis-ci.org/fengyuanchen/viewer) [![Downloads](https://img.shields.io/npm/dm/imageviewer.svg)](https://www.npmjs.com/package/imageviewer) [![Version](https://img.shields.io/npm/v/imageviewer.svg)](https://www.npmjs.com/package/imageviewer) [![Dependencies](https://img.shields.io/david/fengyuanchen/viewer.svg)](https://www.npmjs.com/package/imageviewer) > A simple jQuery image viewing plugin. As of v1.0.0, the core code of Viewer is replaced with [Viewer.js](https://github.com/fengyuanchen/viewerjs). - [Demo](https://fengyuanchen.github.io/viewer) - [Viewer.js](https://github.com/fengyuanchen/viewerjs) - JavaScript image viewer (**recommended**) - [jquery-viewer](https://github.com/fengyuanchen/jquery-viewer) - A jQuery plugin wrapper for Viewer.js (**recommended** for jQuery users to use this instead of Viewer) ## Main ```text dist/ ├── viewer.css ├── viewer.min.css (compressed) ├── viewer.js (UMD) ├── viewer.min.js (UMD, compressed) ├── viewer.common.js (CommonJS, default) └── viewer.esm.js (ES Module) ``` ## Getting started ### Installation ```shell npm install imageviewer jquery ``` Include files: ```html ``` ### Usage Initialize with `$.fn.viewer` method. ```html
Picture
``` ```js var $image = $('#image'); $image.viewer({ inline: true, viewed: function() { $image.viewer('zoomTo', 1); } }); // Get the Viewer.js instance after initialized var viewer = $image.data('viewer'); // View a list of images $('#images').viewer(); ``` ## Options See the available [options](https://github.com/fengyuanchen/viewerjs#options) of Viewer.js. ```js $().viewer(options); ``` ## Methods See the available [methods](https://github.com/fengyuanchen/viewerjs#methods) of Viewer.js. ```js $().viewer('method', argument1, , argument2, ..., argumentN); ``` ## Events See the available [events](https://github.com/fengyuanchen/viewerjs#events) of Viewer.js. ```js $().on('event', handler); ``` ## No conflict If you have to use other plugin with the same namespace, just call the `$.fn.viewer.noConflict` method to revert to it. ```html ``` ## Browser support It is the same as the [browser support of Viewer.js](https://github.com/fengyuanchen/viewerjs#browser-support). As a jQuery plugin, you also need to see the [jQuery Browser Support](https://jquery.com/browser-support/). ## Versioning Maintained under the [Semantic Versioning guidelines](https://semver.org/). ## License [MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com/)