jQuery Simple and Clean Image Lightbox

jQuery Simple and Clean Image Lightbox
Code Snippet:jquery-simple-clean-lightbox
Author: raikerO2
Published: January 12, 2024
Last Updated: January 22, 2024
Downloads: 1,963
License: MIT
Edit Code online: View on CodePen
Read More

A lightweight jQuery plugin to create a simple and clean image lightbox with an image caption. This lightbox plugin simply detects caption from image alt text and shows it in the lightbox popup.

How to Create Simple Clean Image Lightbox

1. First of all load the jQuery JavaScript library and Normalize CSS into the HTML document to get started with a clean lightbox.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>

<!-- Normalize CSS -->	
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css" />

2. After that, create a section, add your image links with alt attribute and place them in an unordered list with a class name gallery.

   <ul class="gallery">
    <li><a href="image/castle.jpg"><img src="image/castle.jpg" alt="Large Castle"></a></li>
    <li><a href="image/nature.jpg"><img src="image/nature.jpg" alt="Beautiful Nature"></a></li>
    <li><a href="image/ship.jpg"><img src="image/ship.jpg" alt ="Wide Ocean"></a></li>
    <li><a href="image/tunnel.jpg"><img src="image/tunnel.jpg" alt ="Misterious Tunnel"></a></li>

3. Finally include the clean lightbox’s CSS and JavaScript files in your webpage and done!

<!-- Clean Lightbox CSS -->
<link rel="stylesheet" href="css/style.css">

<!-- Clean Lightbox JS -->
<script src="js/jquery.clean-lighbox.js"></script>

That’s all! hopefully, you have successfully created a simple and clean image lightbox. If you have any questions or facing any issues, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link