Socket
Socket
Sign inDemoInstall

jquery-viewer

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jquery-viewer

A jQuery plugin wrapper for Viewer.js.


Version published
Weekly downloads
170
decreased by-47.69%
Maintainers
1
Install size
14.5 kB
Created
Weekly downloads
 

Changelog

Source

1.0.1 (Dec 14, 2019)

  • Register as a plugin only when both the jQuery and Cropper.js are existing.

Readme

Source

jquery-viewer

Build Status Coverage Status Downloads Version

A jQuery plugin wrapper for Viewer.js.

Main

dist/
├── jquery-viewer.js        (UMD)
├── jquery-viewer.min.js    (UMD, compressed)
├── jquery-viewer.common.js (CommonJS, default)
└── jquery-viewer.esm.js    (ES Module)

Getting started

Installation

npm install jquery-viewer jquery viewerjs

Include files:

<script src="/path/to/jquery.js"></script><!-- jQuery is required -->
<script src="/path/to/viewer.js"></script><!-- Viewer.js is required -->
<link  href="/path/to/viewer.css" rel="stylesheet">
<script src="/path/to/jquery-viewer.js"></script>

Usage

Initialize with $.fn.viewer method.

<!-- a block container is required -->
<div>
  <img id="image" src="picture.jpg" alt="Picture">
</div>

<div>
  <ul id="images">
    <li><img src="picture-1.jpg" alt="Picture 1"></li>
    <li><img src="picture-2.jpg" alt="Picture 2"></li>
    <li><img src="picture-3.jpg" alt="Picture 3"></li>
  </ul>
</div>
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 of Viewer.js.

$().viewer(options);

Methods

See the available methods of Viewer.js.

$().viewer('method', argument1, , argument2, ..., argumentN);

Events

See the available events of Viewer.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.

<script src="other-plugin.js"></script>
<script src="jquery-viewer.js"></script>
<script>
  $.fn.viewer.noConflict();
  // Code that uses other plugin's "$().viewer" can follow here.
</script>

Browser support

It is the same as the browser support of Viewer.js. As a jQuery plugin, you also need to see the jQuery Browser Support.

Versioning

Maintained under the Semantic Versioning guidelines.

License

MIT © Chen Fengyuan

Keywords

FAQs

Last updated on 14 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc