Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simplelightbox

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplelightbox

Touch-friendly image lightbox for mobile and desktop with jQuery

  • 1.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.5K
increased by7.41%
Maintainers
1
Weekly downloads
 
Created
Source

simplelightbox

Touch-friendly image lightbox for mobile and desktop with jQuery

Install

//Bower
bower install simplelightbox

//NPM
npm install simplelightbox

Usage

Simple include simplelightbox.css and simple-lightbox.js to your page

var lightbox = $('.gallery a').simpleLightbox(options);

###Options

PropertyDefaultTypeDescription
overlaytrueboolshow an overlay or not
spinnertrueboolshow spinner or not
navtrueboolshow arrow-navigation or not
navText['←','→']arraytext or html for the navigation arrows
captionstrueboolshow captions if availabled or not
captionSelector'img'stringset the element where the caption is. Set it to "self" for the A-Tag itself
captionType'attr'stringhow to get the caption. You can choose between attr, data or text
captionsDatatitlestringget the caption from given attribute
closetrueboolshow the close button or not
closeText'×'stringtext or html for the close button
showCountertrueboolshow current image index or not
fileExt'png|jpg|jpeg|gif'regexp or falselist of fileextensions the plugin works with or false for disable the check
animationSpeed250inthow long takes the slide animation
preloadingtrueboolallows preloading next und previous images
enableKeyboardtrueboolallow keyboard arrow navigation and close with ESC key
looptrueboolenables looping through images
docClosetrueboolcloses the lightbox when clicking outside
swipeTolerance50inthow much pixel you have to swipe, until next or previous image
className:'simple-lightbox'stringadds a class to the wrapper of the lightbox
widthRatio:0.8floatRatio of image width to screen width
heightRatio:0.9floatRatio of image height to screen height
disableRightClickfalsebooldisable rightclick on image or not
disableScrolltrueboolstop scrolling page if lightbox is openend

###Events

NameDescription
open.simplelightboxthis event fires before the lightbox opens
opened.simplelightboxthis event fires after the lightbox was opened
close.simplelightboxthis event fires before the lightbox closes
closed.simplelightboxthis event fires after the lightbox was closed

Example

$('.gallery a').on('open.simplelightbox', function () {
  // do something…
});

###Public Methods

NameDescription
openOpens the lightbox with an given jQuery Element
closeCloses current openend Lightbox
nextGo to next image
prevGo to previous image
destroyDestroys the instance of the lightbox

Example

var gallery = $('.gallery a').simpleLightbox();

gallery.next(); // Next Image

Changelog

1.5.0 - Added options for disabling rightclick and scrolling, changed default prev- and next-button text
1.4.6 - Option for fileExt can now be false to enable pictures like example.com/pic/200/100
1.4.5 - Bugfix lightbox opening does not work on mobile devices
1.4.4 - Bugfix no drag&drop in FF, changed default close text, only output data if lightbox is opened
1.4.3 - Bugfix z-index for spinner to low, added sass files
1.4.2 - Bugfix for issue #2 - Drop Event does not fire when mouse leaves window
1.4.1 - The whole caption Selector is rewritten. You can now select an element and get its text, use data or attribute
1.4.0 - Caption Attribute can now be what, you want, or data-title. Fixed some small issues
1.3.1 - Bugfix: disable keyboard control if lightbox is closed
1.3.0 - Added current index indicator/counter
1.2.0 - Added option for captions attribute (title or data-title)
1.1.2 - Bugfix for looping images
1.1.1 - Bugfix for loading indicator and removed a log-event
1.1.0 - Added classname for lightbox wrapper and width/height ratio
1.0.0 - Initial Release

Keywords

FAQs

Package last updated on 07 Nov 2015

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