Creative Image Modal With Blur Background - jQuery ClarityLightbox

File Size: 24.2 KB
Views Total: 2104
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Creative Image Modal With Blur Background - jQuery ClarityLightbox

ClarityLightbox is a lightweight jQuery plugin to showcase your images in a responsive modal popup while blurring the overlaid main content using the CSS3 blur filter.

How to use it:

1. The plugin uses the simple-line-icons for the modal icons (OPTIONAL).

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css">

2. Load jQuery library (slim build is recommonded) and the jQuery ClarityLightbox plugin's files in the document.

<link rel="stylesheet" href="dist/clarity-lightbox.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.js"
        integrity="sha256-fNXJFIlca05BIO2Y5zh1xrShK3ME+/lYZ0j+ChxX2DA="
        crossorigin="anonymous">
</script>
<script src="dist/clarity-lightbox.min.js"></script>

3. Add a link with the CSS class of 'lightbox' to your images and done.

<a class="lightbox" href="large-1.jpg">
  <img src="thumb-1.jpg">
</a>

<a class="lightbox" href="large-2.jpg">
  <img src="thumb-2.jpg">
</a>

<a class="lightbox" href="large-3.jpg">
  <img src="thumb-3.jpg">
</a>

...

4. To customize the close icon, override the default modal template in the JavaScript.

$('body').append('<div class="modal">\n' +
  '    <div class="modal-content">\n' +
  '        <span class="close icon-close"></span>\n' +
  '        <img src="" class="modal-image">\n' +
  '    </div>\n' +
  '</div>');

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