Skip to content

nzbin/photoviewer

Folders and files

NameName
Last commit message
Last commit date
Oct 1, 2019
Sep 10, 2024
Sep 10, 2024
Mar 16, 2024
Sep 10, 2024
Mar 16, 2024
Sep 17, 2020
Apr 14, 2023
Jul 13, 2018
Jul 23, 2023
Sep 17, 2020
Apr 13, 2023
Nov 15, 2021
Jul 7, 2018
Dec 29, 2023
Apr 13, 2023
Sep 3, 2024
Sep 10, 2024
Sep 6, 2023
Nov 25, 2023

Repository files navigation

PhotoViewer

Travis npm license Gitter Financial Contributors on Open Collective

photoviewer

PhotoViewer is a JS plugin to view images just like in Windows.

If you want to support IE8, please goto Magnify.

Quick links

Documentation | Examples

Features

  • Vanilla JS
  • Modal draggable
  • Modal resizable
  • Modal maximizable
  • Image movable
  • Image zoomable
  • Image rotatable
  • Keyboard control
  • Fullscreen showing
  • Multiple instances
  • Browser support IE9+
  • RTL support

Installation

You can install the plugin via npm

$ npm install photoviewer --save

Quick Start

Step 1: Include files

@use 'photoviewer';
import PhotoViewer from 'photoviewer';

or

<!-- Core CSS file -->
<link href="/path/to/photoviewer.css" rel="stylesheet">

<!-- Core JS file -->
<script src="/path/to/photoviewer.js"></script>

Step 2: Initializing

The usage of photoviewer is very simple, the PhotoViewer's constructor has 2 arguments.

  1. Array with objects of image info.
  2. Options
// build images array
var items = [
    {
        src: 'path/to/image1.jpg', // path to image
        title: 'Image Caption 1' // If you skip it, there will display the original image name(image1)
    },
    {
        src: 'path/to/image2.jpg',
        title: 'Image Caption 2'
    }
];

// define options (if needed)
var options = {
    // optionName: 'option value'
    // for example:
    index: 0 // this option means you will start at first image
};

// Initialize the plugin
var photoviewer = new PhotoViewer(items, options);

Step 3: Binding Event

At last, binding click event on a button element at initializing.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

MIT License