Easy Responsive Photo Lightbox Gallery Plugin - photoGallery

Easy Responsive Photo Lightbox Gallery Plugin - photoGallery
File Size: 51.1 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A simple and easy-to-use jQuery gallery lightbox plugin to present full-sized images in a responsive, fullscreen gallery lightbox popup that allows you to navigate through images with next / prev buttons and keyboard arrows.

How to use it:

1. Add your images to the gallery using html5 data-* attributes as displayed below.

  • data-src: the path to your large image.
  • data-id: the unique ID of your image.
  • data-desc: the image descriptions.
<div id="photoGallery-container">
  <img class="photoGallery" 
       data-src="1-large.jpg" 
       src="1-thumb.jpg" 
       data-id="pic_1" 
       data-desc="Description 1">

  <img class="photoGallery" 
       data-src="2-large.jpg" 
       src="2-thumb.jpg" 
       data-id="pic_2" 
       data-desc="Description 2">

  <img class="photoGallery" 
       data-src="3-large.jpg" 
       src="3-thumb.jpg" 
       data-id="pic_3" 
       data-desc="Description 3">

  ...

</div>

2. Add the required styles to your CSS file. You can modify or override the following CSS snippets to create your own styles.

#photoGallery-container {
  width: 65%;
  margin: 10px auto;
  text-align: center;
}

.photoGallery {
  width: 200px;
  height: 200px;
  -webkit-transition: all 0.5s;
  cursor: pointer;
}

.photoGallery:hover {
  -webkit-transform: scale(1.1);
  box-shadow: 0 0 2px 2px #ddd;
  z-index: 3;
}

#photoGallery-mask {
  width: 100%;
  height: 100%;
  background: #000;
  opacity: 0.7;
  fliter: alpha(opacity=70);
  z-index: 9998;
  position: fixed;
  top: 0;
  left: 0;
  background: url(../img/opacity.png) repeat left top\9;
  display: none;
}

#photoGallery-mask .photoGallery-btn {
  width: 10%;
  height: 100%;
  position: absolute;
  top: 0;
}

#photoGallery-mask .photoGallery-prev-btn { left: 0; }

#photoGallery-mask .photoGallery-next-btn { right: 0; }

#photoGallery-mask .photoGallery-prev-btn-show {
  background: url(../img/prev.png) no-repeat left center;
  cursor: pointer;
}

#photoGallery-mask .photoGallery-next-btn-show {
  background: url(../img/next.png) no-repeat right center;
  cursor: pointer;
}

#photoGallery-picWrapper {
  width: 800px;
  height: 500px;
  background: #fff url(../img/loading.gif) no-repeat center center;
  border: 5px solid #fff;
  border-radius: 5px;
  position: fixed;
  top: 50%;
  left: 50%;
  margin-left: -400px;
  margin-top: -250px;
  color: #fff;
  text-align: center;
  font-size: 16px;
  z-index: 9999;
  display: none;
}

#photoGallery-picWrapper .photoGallery-close-btn {
  width: 27px;
  height: 27px;
  background: url(../img/close.png) no-repeat center center;
  position: absolute;
  right: 5px;
  top: 5px;
  z-index: 3;
  cursor: pointer;
}

#photoGallery-picWrapper .photoGallery-picCon {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

#photoGallery-picWrapper .photoGallery-picIndex {
  display: block;
  width: 100%;
  height: 40px;
  line-height: 40px;
  background: rgba(0,0,0,0.2);
  position: absolute;
  top: 0;
  left: 0;
  background: url(../img/opacity.png) repeat left top\9;
  z-index: 2;
}

#photoGallery-picWrapper .photoGallery-picDesc {
  display: block;
  width: 100%;
  height: 60px;
  line-height: 40px;
  background: rgba(0,0,0,0.3);
  position: absolute;
  bottom: 0;
  left: 0;
  background: url(../img/opacity.png) repeat left top\9;
  text-align: left;
  text-indent: 25px;
  z-index: 2;
}

3. Include jQuery library and the jQuery photoGallery plugin at the bottom of the web page.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="js/photoGallery.js"></script>

4. Create a new gallery instance.

var photoGallery = new PhotoGallery();

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