Simplest jQuery Lightbox Overlay Plugin - Flashlight

Simplest jQuery Lightbox Overlay Plugin - Flashlight
File Size: 3.43 KB
Views Total: 2592
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Flashlight is a minimalist jQuery lightbox plugin that currently supports showing large images in a responsive, fullscreen overlay popup. The support of group Elements, Youtube/Vimeo videos will come soon.

Basic usage:

1. Add a link to your thumbnail that points to the large image to be shown in the lightbox. The img's title attribute is required for the lightbox description.

<a href="large.jpg" class="light">
  <img src="thumb.jpg" title="Image Caption">
</a>

2. Load jQuery library and the jQuery flashlight plugin at the bottom of the web page.

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="flashlight.js"></script>

3. Enable the lightbox plugin.

$('.light').flashlight();

4. The basic CSS styles for the lightbox & overlay.

.flashlight_overlay {
  display: none;
  position: fixed;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
  background-color: #333;
  z-index: 1001;
  -moz-opacity: 1;
  opacity: 1;
  filter: alpha(opacity=1);
}

.flashlight_content {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  background-color: white;
  z-index: 1002;
  overflow: hidden;
}

.flashlight_desc { padding: 10px; }

.flashlight_title {
  width: 100%;
  text-align: left;
  padding-top: 2px;
  font-weight: bold;
}

.flashlight_image { width: 100%; }

.flashlight_close {
  float: right;
  display: inline-block;
  position: relative;
  top: -3px;
  cursor: pointer;
  text-decoration: none;
  color: #333;
}

.flashlight { opacity: 1; }

.flashlight:hover { opacity: 0.7; }

5. Make the lightbox responsive using CSS media queries.

@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {

.flashlight_content { width: 95%; }

}


@media only screen and (min-width : 321px) {

.flashlight_content { width: auto; }

}

Change log:

2015-04-01

  • Update flashlight.js

This awesome jQuery plugin is developed by yasinbec. For more Advanced Usages, please check the demo page or visit the official website.