Lightbox/弹窗

强大jquery图片画廊Lightbox插件

阿里云

LC Lightbox 是一款强大的图片画廊式 jquery Lightbox 插件。LC Lightbox 采用响应式设计,功能强大,支持移动手机,支持缩略图等,是现代网页设计的首选 lightbox 插件。LC Lightbox 插件的特点还有:

支持单张图片或图片画廊模式

也想出现在这里?联系我们
创客主机

支持图片预加载

内置 light、dark 和 minimal 三种主题样式

可定制缩略图导航

支持分享和下载图片

支持全屏模式

支持移动手机的滑动和桌面浏览器的鼠标滚轮事件

提供大量的配置参数可供使用

使用方法:

在页面中引入 jquery 和 lc_lightbox.lite.js 文件,以及样式文件 lc_lightbox.css。在三种主题中选择一种来使用,引入相应的 css 文件。
伪类支持移动设备的手指滑动事件,还需要引入 AlloyFinger 插件。

  1. <link rel="stylesheet" href="path/to/lc_lightbox.css">
  2. <link rel="stylesheet" href="path/to/skins/dark.css">
  3. <!-- 或者 -->
  4. <!--
  5. <link rel="stylesheet" href="path/to/skins/light.css">
  6. <link rel="stylesheet" href="path/to/skins/minimal.css">
  7. -->
  8. <script src="path/to/jquery.min.js"></script>
  9. <script src="path/to/lc_lightbox.lite.js"></script>
  10. <script src="path/to/alloy_finger.min.js"></script>

HTML 结构:

该 LC Lightbox 插件的基本 HTML 结构如下:

  1. <a class="elem"
  2.    href="large1.jpg"
  3.    title="image 1"
  4.    data-lcl-txt="Description 1"
  5.    data-lcl-author="Author 1"
  6.    data-lcl-thumb="thumb1.jpg">
  7.   <span style="background-image: url(thumb1.jpg);"></span>
  8. </a>
  9.  
  10. <a class="elem"
  11.    href="large2.jpg"
  12.    title="image 2"
  13.    data-lcl-txt="Description 2"
  14.    data-lcl-author="Author 2"
  15.    data-lcl-thumb="thumb2.jpg">
  16.   <span style="background-image: url(thumb2.jpg);"></span>
  17. </a>
  18.  
  19. <a class="elem"
  20.    href="large1.jpg"
  21.    title="image 3"
  22.    data-lcl-txt="Description 3"
  23.    data-lcl-author="Author 3"
  24.    data-lcl-thumb="thumb3.jpg">
  25.   <span style="background-image: url(thumb3.jpg);"></span>
  26. </a>

其中,data-lcl-txt 是图片的描述信息。data-lcl-author 是图片的作者信息。data-lcl-thumb 是缩略图的路径。

初始化插件:

在页面 DOM 元素加载完毕之后,通过下面的方法来初始化该 jquery Lightbox 插件。

  1. $(document).ready(function() {
  2.     lc_lightbox('.elem', {
  3.         wrap_class: 'lcl_fade_oc',
  4.         gallery : true, 
  5.         thumb_attr: 'data-lcl-thumb', 
  6.         skin: 'dark'
  7.     }); 
  8. });

配置参数:

LC Lightbox 插件的所有可用配置参数如下,具体请参考官方说明文档。

  1. lc_lightbox('.elem', {
  2.  
  3.   // whether to display a single element or compose a gallery
  4.   gallery     : true, 
  5.  
  6.   // attribute grouping elements - use false to create a gallery with all fetched elements 
  7.   gallery_hook  : 'rel', 
  8.  
  9.   // if a selector is found, set true to handle automatically DOM changes
  10.   live_elements : true, 
  11.  
  12.   // whether to preload all images on document ready
  13.   preload_all   : false, 
  14.  
  15.   // force elements type
  16.   global_type   : 'image', 
  17.  
  18.   // attribute containing element's source
  19.   src_attr    : 'href', 
  20.  
  21.   // attribute containing the title - is possible to specify a selector with this syntax: "> .selector" or "> span" 
  22.   title_attr    : 'title', 
  23.  
  24.   // attribute containing the description - is possible to specify a selector with this syntax: "> .selector" or "> span" 
  25.   txt_attr    : 'data-lcl-txt', 
  26.  
  27.   // attribute containing the author - is possible to specify a selector with this syntax: "> .selector" or "> span" 
  28.   author_attr   : 'data-lcl-author', 
  29.  
  30.   // whether to enable slideshow
  31.   slideshow   : true, 
  32.  
  33.   // animation duration for lightbox opening and closing / 1000 = 1sec
  34.   open_close_time : 500, 
  35.  
  36.   // overlay's animation advance (on opening) and delay (on close) to window / 1000 = sec
  37.   ol_time_diff  : 100, 
  38.  
  39.   // elements fading animation duration in millisecods / 1000 = 1sec
  40.   fading_time   : 150, 
  41.  
  42.   // sizing animation duration in millisecods / 1000 = 1sec
  43.   animation_time  : 300, 
  44.  
  45.   // slideshow interval duration in milliseconds / 1000 = 1sec
  46.   slideshow_time  : 6000, 
  47.  
  48.   // autoplay slideshow - bool
  49.   autoplay    : false, 
  50.  
  51.   // whether to display elements counter
  52.   counter     : false, 
  53.  
  54.   // whether to display a progressbar when slideshow runs
  55.   progressbar   : true, 
  56.  
  57.   // whether to create a non-stop pagination cycling elements
  58.   carousel    : true, 
  59.  
  60.   // Lightbox maximum width. 
  61.   // Use a responsive percent value or an integer for static pixel value
  62.   max_width   : '93%', 
  63.  
  64.   // Lightbox maximum height. 
  65.   // Use a responsive percent value or an integer for static pixel value
  66.   max_height    : '93%', 
  67.  
  68.   // overlay opacity / value between 0 and 1
  69.   ol_opacity    : 0.7, 
  70.  
  71.   // background color of the overlay
  72.   ol_color    : '#111', 
  73.  
  74.   // overlay patterns - insert the pattern name or false
  75.   ol_pattern    : false, 
  76.  
  77.   // width of the lightbox border in pixels 
  78.   border_w    : 3, 
  79.  
  80.   // color of the lightbox border
  81.   border_col    : '#ddd', 
  82.  
  83.   // width of the lightbox padding in pixels
  84.   padding     : 10, 
  85.  
  86.   // lightbox border radius in pixels 
  87.   radius      : 4, 
  88.  
  89.   // whether to apply a shadow around lightbox window
  90.   shadow      : true, 
  91.  
  92.   // whether to hide page's vertical scroller
  93.   remove_scrollbar: true, 
  94.  
  95.   // custom classes added to wrapper - for custom styling/tracking
  96.   wrap_class    : '', 
  97.  
  98.   // light / dark / Minimal
  99.   skin      : 'light', 
  100.  
  101.   // over / under / lside / rside
  102.   data_position : 'over', 
  103.  
  104.   // inner / outer
  105.   cmd_position  : 'inner',  
  106.  
  107.   // set closing button position for inner commands - normal/corner 
  108.   ins_close_pos : 'normal', 
  109.  
  110.   // set arrows and play/pause position - normal/middle
  111.   nav_btn_pos   : 'normal', 
  112.  
  113.   // whether to hide texts on lightbox opening - bool or int (related to browser's smaller side)
  114.   txt_hidden    : 500, 
  115.  
  116.   // bool / whether to display titles
  117.   show_title    : true, 
  118.  
  119.   // bool / whether to display descriptions
  120.   show_descr    : true, 
  121.  
  122.   // bool / whether to display authors
  123.   show_author   : true, 
  124.  
  125.   // enables thumbnails navigation (requires elements poster or images)
  126.   thumbs_nav    : true, 
  127.  
  128.   // print type icons on thumbs if types are mixed
  129.   tn_icons    : true, 
  130.  
  131.   // whether to hide thumbs nav on lightbox opening - bool or int (related to browser's smaller side)
  132.   tn_hidden   : 500, 
  133.  
  134.   // width of the thumbs for the standard lightbox
  135.   thumbs_w    : 110, 
  136.  
  137.   // height of the thumbs for the standard lightbox
  138.   thumbs_h    : 110, 
  139.  
  140.   // attribute containing thumb URL to use or false to use thumbs maker
  141.   thumb_attr    : false, 
  142.  
  143.   // script baseurl to create thumbnails (use src=%URL% w=%W% h=%H%)
  144.   thumbs_maker_url: false, 
  145.  
  146.   // Allow the user to expand a resized image. true/false
  147.   fullscreen    : true, 
  148.  
  149.   // resize mode of the fullscreen image - smart/fit/fill
  150.   fs_img_behavior : 'fit', 
  151.  
  152.   // when directly open in fullscreen mode - bool or int (related to browser's smaller side)
  153.   fs_only     : 500, 
  154.  
  155.   // whether to trigger or nor browser fullscreen mode
  156.   browser_fs_mode : true, 
  157.  
  158.   // bool
  159.   socials     : true, 
  160.  
  161.   // bool / allow text hiding
  162.   txt_toggle_cmd  : true, 
  163.  
  164.   // bool / whether to add download button
  165.   download    : true, 
  166.  
  167.   // bool / Allow touch interactions for mobile (requires AlloyFinger)
  168.   touchswipe    : true, 
  169.  
  170.   // bool / Allow elements navigation with mousewheel
  171.   mousewheel    : true, 
  172.  
  173.   // enable modal mode (no closing on overlay click)
  174.   modal     : false, 
  175.  
  176.   // whether to avoid right click on lightbox
  177.   rclick_prevent  : false
  178.  
  179. });

LC Lightbox-jquery Lightbox 插件的 github 地址为:https://github.com/LCweb-ita/LC-Lightbox-LITE

强大 jquery 图片画廊 Lightbox 插件

已有 366 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!