JQuery Lightbox is a JavaScript library that displays images and videos by filling the screen.Thiis simple lightbox plugin based on the bootstrap modal plugin.Lightbox is a library that offers a nice and elegant way to add zooming functionality for images in modal.
How to User Lightbox ?
Step 1 - Load the Javascript and CSS
- Download and unzip the Lightbox from here.
- Look inside the
jsfolder to findjquery-1.11.0.min.jsandlightbox.min.jsand load both of these files. Load jQuery first.<script src="js/jquery-1.11.0.min.js"></script> <script src="js/lightbox.min.js"></script> - Look inside the
cssfolder to findlightbox.cssand load it.<link href="css/lightbox.css" rel="stylesheet" /> - Look inside the
imgfolder to findclose.png,loading.gif,prev.png, andnext.png. These files are used inlightbox.css. By default,lightbox.csswill look for these images in a folder calledimg.
Step 2 - Turn it on
- Add a
data-lightboxattribute to any image link to activate Lightbox. For the value of the attribute, use a unique name for each image. For example:
Optional: Add a<a href="img/image-1.jpg" data-lightbox="image-1" data-title="My caption">Image #1</a>data-titleattribute if you want to show a caption. - If you have a group of related images that you would like to combine into a set, use the same
data-lightboxattribute value for all of the images. For example:<a href="img/image-2.jpg" data-lightbox="roadtrip">Image #2</a> <a href="img/image-3.jpg" data-lightbox="roadtrip">Image #3</a> <a href="img/image-4.jpg" data-lightbox="roadtrip">Image #4</a>