Lightbox is a simple JavaScript library that displays images or videos on the same page of a browser by filling part of the screen and dimming out the rest of the web page.
It is very helpful because it opens the image on your current web page instead of taking you to the link of the image.
$ git clone https://github.com/Rhotimee/bootstrap4-beta-starter-pack.git <a href="http://lrempixel.com/560/560/sports/2"
data-toggle="lightbox" data-gallery="img-gallery">
<img src="http://lrempixel.com/400/400/sports/2"
class="img-fluid">
</a>
Make sure You specify that data-toggle = "lightbox"
Css
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" />
Js
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.js"></script>
$(document).on('click', '[data-toggle="lightbox"]', function(event){
event.preventDefault();
$(this).ekkoLightbox();
});
See Screenshot of the Browser:
See full code in my Github Repo.
GITHUB: https://github.com/Rhotimee/lightbox-for-bootstrap
If you have any question or issue, I would be glad to help.
Enjoy!