SyntaxStudy
Sign Up
jQuery Beginner 3 min read

lightGallery Plugin

lightGallery

lightGallery creates a touch-friendly, responsive image and video gallery lightbox. Initialize on a container with anchor tags.

Example
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lightgallery@2/css/lightgallery.css">
<script src="https://cdn.jsdelivr.net/npm/lightgallery@2/lightgallery.min.js"></script>

<div id="gallery">
  <a href="img/full1.jpg"><img src="img/thumb1.jpg" class="img-thumbnail" alt="Photo 1"></a>
  <a href="img/full2.jpg"><img src="img/thumb2.jpg" class="img-thumbnail" alt="Photo 2"></a>
</div>

<script>
lightGallery(document.getElementById("gallery"), {
  speed: 500,
  download: false
});
</script>
Pro Tip

lightGallery 2 is framework-agnostic and no longer requires jQuery.