Check out the WordPress Plugin of lightGallery

Lightgallery hash plugin

lightGallery hash plugin lets you to provide unique url for each gallery images. 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>
  <a href="img/img2.jpg">
      <img src="img/thumb2.jpg" />
  </a>
  ...
</div>

Javascript

$('#hash').lightGallery();

// if You have multiple galleries on same page you have to set unique id's for each gallery.
/* 
$('#hash').lightGallery({
    galleryId: 2
});
$('#hash').lightGallery({
    galleryId: 3
});
*/