lightgallery 使用

用途

  • 图片预览,支持多图片滑动预览

git 地址

代码

# idnex.html
<script src="js/lightGallery.js"></script>

# imagePreview.html
<div id="lightgallery">
  <a href="img/img1.jpg">
      <img src="img/thumb1.jpg" />
  </a>
  <a href="img/img2.jpg">
      <img src="img/thumb2.jpg" />
  </a>
  ...
</div>

<script type="text/javascript">
    lightGallery(document.getElementById('lightgallery')); 
</script>
或
<script type="text/javascript">
  $(document).ready(function() {
    $("#lightGallery").lightGallery(); 
  });
</script>
原文地址:https://www.cnblogs.com/shellon/p/14858751.html