响应式图像/视频灯箱库 jQuery LBT灯箱

  • 源码大小:27.26KB
  • 所需积分:1积分
  • 源码编号:19JP-3197
  • 浏览次数:1177次
  • 最后更新:2023年05月17日
  • 所属栏目:图库
本站默认解压密码:19jp.com 或 19jp_com

简介

LBT Lightbox是一个响应迅速且易于使用的jQuery gallery Lightbox插件,它提供了一种用户友好的方式来在您的网站或web应用程序上展示图像和视频。

它能够在易于导航的灯箱弹出窗口中显示您的内容,并支持各种内容,包括图像、YouTube视频、Vimeo视频和HTML5视频

非常适合摄影师、艺术家和网络/移动开发人员,他们希望以优雅的方式展示自己的作品集、画廊和项目。

参见:

  • JavaScript和CSS中的10个最佳灯箱库插件

如何使用它:

1.开始加载所需的JavaScript和CSS文件,如下所示:

  1. <link rel="stylesheet" href="/path/to/dist/css/jquery.lbt-lightbox.min.css" />
  2. <script src="/path/to/cdn/jquery.min.js"></script>
  3. <script src="/path/to/dist/js/jquery.lbt-lightbox.min.js"></script>

2.将您的内容和标题一起添加到多媒体资料中。

  1. <div id="gallery">
  2. <div class="item">
  3. <img src="1.jpg" alt="image1" />
  4. <div class="caption">
  5. <p>Description 1</p>
  6. </div>
  7. </div>
  8. <div class="item">
  9. <img src="2.jpg" alt="image2" />
  10. <div class="caption">
  11. <p>Description 2</p>
  12. </div>
  13. </div>
  14. <div class="item">
  15. <img src="3.jpg" alt="image3" />
  16. <div class="caption">
  17. <p>Description 3</p>
  18. </div>
  19. </div>
  20. ... more items here
  21. </div>

3.初始化插件以创建默认的灯箱库。

  1. $('#gallery').lbtLightBox({
  2.  
  3. // content selector
  4. custom_children: ".item img",
  5.  
  6. // enable captions
  7. captions: true,
  8. captions_selector: ".item p",
  9. });

4.配置缩略图分页。

  1. $('#gallery').lbtLightBox({
  2.  
  3. // the number of thumbnails in the pagination
  4. qtd_pagination: 8,
  5.  
  6. // width/height of the thumbnail pagination
  7. pagination_width: "60px",
  8. pagination_height: "60px",
  9.  
  10. });

5.更新图库。

  1. $instance = $('#gallery').lbtLightBox({
  2. // ...
  3. });
  4. $instance.update();

6.预加载图像。

  1. $instance = $('#gallery').lbtLightBox({
  2. // ...
  3. });
  4. $instance.preload();

7.启用IndexedDB客户端数据库支持。

  1. $('#gallery').lbtLightBox({
  2.  
  3. db: true,
  4. });

更新日志:

2023-02-07

  • 添加IndexedDB支持

2023-02-03

  • 增加了预加载功能

2023-02-02

  • 错误修复

预览截图