Minimalist Responsive Image Lightbox Plugin
| File Size: | 3.61 KB |
|---|---|
| Views Total: | 1067 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
This is a minimalist, responsive, jQuery based image lightbox plugin used to overlay your images on top of the current page.
How to use it:
1. Add a link to your image and specify the image path to open in the lightbox using the data-img attribute.
<a class="lightbox"
href="#"
data-img="full.jpg">
<img src="thumb.jpg">
</a>
2. Add the JavaScript file lightbox.js to the webpage, after the latest jQuery JavaScript library.
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous">
</script>
<script src="js/lightbox.js"></script>
3. Call the function to enable the image lightbox plugin.
(function($) {
$('.lightbox').lightbox();
})(jQuery);
4. The example CSS to style the image lightbox.
.show-lightbox{
background-color:rgba(0, 0, 0, 0.8);
width: 100%;
height: 100%;
position: fixed;
z-index: 999;
left: 0;
right: 25%;
top: 0;
text-align: right;
display: none;
}
.lightbox__media img{
width: 60%;
height: auto;
display: block;
margin: auto;
}
.lightbox__close img{
height: 35px;
width: 35px;
text-align: center;
margin: 10px;
}
html.lightbox,
body.lightbox{
height: 100%;
overflow-y: hidden;
}
This awesome jQuery plugin is developed by adminricardo93. For more Advanced Usages, please check the demo page or visit the official website.











