New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

parvus

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parvus

An accessible, open-source image lightbox with no dependencies.

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
583
decreased by-6.42%
Maintainers
1
Weekly downloads
 
Created
Source

Parvus

An accessible, open-source image lightbox with no dependencies.

Play on CodePen

Table of contents

Get Parvus

Download

CSS: dist/css/parvus.min.css minified, or dist/css/parvus.css un-minified

JavaScript: dist/js/parvus.min.js minified, or dist/js/parvus.js un-minified

Images: dist/images/zoom-in.svg and dist/images/zoom-out.svg

Package managers

Parvus is also available on npm.

npm install parvus --save

Usage

You can install Parvus by linking the .css and .js files to your HTML file. The HTML code may look like this:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Page title</title>

  <!-- CSS -->
  <link href="path/to/parvus.min.css" rel="stylesheet">
</head>
<body>
  <!-- HTML content -->

  <!-- JS -->
  <script src="path/to/parvus.min.js"></script>
</body>
</html>

The standard way of using Parvus is a linked thumbnail image with the class name lightbox to a larger image:

<a href="path/to/image.jpg" class="lightbox">
  <img src="path/to/thumbnail.jpg" alt="">
</a>

Initialize the script by running:

const prvs = new parvus()

Options

You can pass an object with custom options as an argument.

const prvs = new parvus({
  scrollClose: false
})

The following options are available:

PropertyTypeDefaultDescription
selectorstring".lightbox"All elements with this class triggers Parvus
lightboxLabelstring"..."ARIA label for screen readers
lightboxLoadingIndicatorLabelstring"..."ARIA label for screen readers
swipeClosebooltrueSwipe up to close Parvus
scrollClosebooltrueScroll to close Parvus
thresholdnumber100Touch dragging threshold (in px)
transitionDurationnumber300Specifies how many milliseconds (ms) the transition effects takes to complete
transitionTimingFunctionstring'...'Specifies the speed curve of the transition effects

API

FunctionDescription
open(element)Open element (DOM element)
close()Close Parvus
add(element)Add element (DOM element)
remove(element)Remove element (DOM element)
isOpen()Check if Parvus is open
destroy()Destroy Parvus

Events

Bind events with the .on() and .off() methods.

const prvs = new parvus()

const listener = function listener () {
  console.log('eventName happened')
}

// bind event listener
prvs.on(eventName, listener)

// unbind event listener
prvs.off(eventName, listener)
eventNameDescription
openTriggered after Parvus has been opened
closeTriggered after Parvus has been closed
destroyTriggered after Parvus has been destroyed

Browser support

Parvus supports the following browser (all the latest versions):

  • Chrome
  • Edge
  • Firefox
  • Safari

Keywords

FAQs

Package last updated on 01 Nov 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc