lightgallery.js 1.x is not actively maintained . Please upgrade to version 2

Lightgallery hash plugin

lightGallery hash plugin lets you to provide unique url for each gallery images. lightGallery will record slide history and allows you to travel to previous slides via browser back button.If you have multiple galleries on one page you have to provide unique id's for each gallery via galleryId setting.

Plugin dependency

Lightgallery require the hash plugin to be included in your document.

HTML structure

<div id="hash">
  <a href="img/img1.jpg">
      <img src="img/thumb1.jpg" />
  <a href="img/img2.jpg">
      <img src="img/thumb2.jpg" />



// if You have multiple galleries on same page you have to set unique id's for each gallery.
lightGallery(document.getElementById('hash'), {
    galleryId: 2
lightGallery(document.getElementById('hash'), {
    galleryId: 3