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

支持图片预加载
内置 light、dark 和 minimal 三种主题样式
可定制缩略图导航
支持分享和下载图片
支持全屏模式
支持移动手机的滑动和桌面浏览器的鼠标滚轮事件
提供大量的配置参数可供使用
在页面中引入 jquery 和 lc_lightbox.lite.js 文件,以及样式文件 lc_lightbox.css。在三种主题中选择一种来使用,引入相应的 css 文件。
伪类支持移动设备的手指滑动事件,还需要引入 AlloyFinger 插件。
<link rel="stylesheet" href="path/to/lc_lightbox.css">
<link rel="stylesheet" href="path/to/skins/dark.css">
<!-- 或者 -->
<!--<link rel="stylesheet" href="path/to/skins/light.css">
<link rel="stylesheet" href="path/to/skins/minimal.css">
--><script src="path/to/jquery.min.js"></script>
<script src="path/to/lc_lightbox.lite.js"></script>
<script src="path/to/alloy_finger.min.js"></script>
该 LC Lightbox 插件的基本 HTML 结构如下:
<a class="elem"
href="large1.jpg"
title="image 1"
data-lcl-txt="Description 1"
data-lcl-author="Author 1"
data-lcl-thumb="thumb1.jpg">
<span style="background-image: url(thumb1.jpg);"></span>
</a>
<a class="elem"
href="large2.jpg"
title="image 2"
data-lcl-txt="Description 2"
data-lcl-author="Author 2"
data-lcl-thumb="thumb2.jpg">
<span style="background-image: url(thumb2.jpg);"></span>
</a>
<a class="elem"
href="large1.jpg"
title="image 3"
data-lcl-txt="Description 3"
data-lcl-author="Author 3"
data-lcl-thumb="thumb3.jpg">
<span style="background-image: url(thumb3.jpg);"></span>
</a>
其中,data-lcl-txt 是图片的描述信息。data-lcl-author 是图片的作者信息。data-lcl-thumb 是缩略图的路径。
在页面 DOM 元素加载完毕之后,通过下面的方法来初始化该 jquery Lightbox 插件。
$(document).ready(function() {
lc_lightbox('.elem', {
wrap_class: 'lcl_fade_oc',
gallery : true,
thumb_attr: 'data-lcl-thumb',
skin: 'dark'
});
});
LC Lightbox 插件的所有可用配置参数如下,具体请参考官方说明文档。
lc_lightbox('.elem', {
// whether to display a single element or compose a gallerygallery : true,
// attribute grouping elements - use false to create a gallery with all fetched elements gallery_hook : 'rel',
// if a selector is found, set true to handle automatically DOM changeslive_elements : true,
// whether to preload all images on document readypreload_all : false,
// force elements typeglobal_type : 'image',
// attribute containing element's sourcesrc_attr : 'href',
// attribute containing the title - is possible to specify a selector with this syntax: "> .selector" or "> span" title_attr : 'title',
// attribute containing the description - is possible to specify a selector with this syntax: "> .selector" or "> span" txt_attr : 'data-lcl-txt',
// attribute containing the author - is possible to specify a selector with this syntax: "> .selector" or "> span" author_attr : 'data-lcl-author',
// whether to enable slideshowslideshow : true,
// animation duration for lightbox opening and closing / 1000 = 1secopen_close_time : 500,
// overlay's animation advance (on opening) and delay (on close) to window / 1000 = secol_time_diff : 100,
// elements fading animation duration in millisecods / 1000 = 1secfading_time : 150,
// sizing animation duration in millisecods / 1000 = 1secanimation_time : 300,
// slideshow interval duration in milliseconds / 1000 = 1secslideshow_time : 6000,
// autoplay slideshow - boolautoplay : false,
// whether to display elements countercounter : false,
// whether to display a progressbar when slideshow runsprogressbar : true,
// whether to create a non-stop pagination cycling elementscarousel : true,
// Lightbox maximum width. // Use a responsive percent value or an integer for static pixel valuemax_width : '93%',
// Lightbox maximum height. // Use a responsive percent value or an integer for static pixel valuemax_height : '93%',
// overlay opacity / value between 0 and 1ol_opacity : 0.7,
// background color of the overlayol_color : '#111',
// overlay patterns - insert the pattern name or falseol_pattern : false,
// width of the lightbox border in pixels border_w : 3,
// color of the lightbox borderborder_col : '#ddd',
// width of the lightbox padding in pixelspadding : 10,
// lightbox border radius in pixels radius : 4,
// whether to apply a shadow around lightbox windowshadow : true,
// whether to hide page's vertical scrollerremove_scrollbar: true,
// custom classes added to wrapper - for custom styling/trackingwrap_class : '',
// light / dark / Minimalskin : 'light',
// over / under / lside / rsidedata_position : 'over',
// inner / outercmd_position : 'inner',
// set closing button position for inner commands - normal/corner ins_close_pos : 'normal',
// set arrows and play/pause position - normal/middlenav_btn_pos : 'normal',
// whether to hide texts on lightbox opening - bool or int (related to browser's smaller side)txt_hidden : 500,
// bool / whether to display titlesshow_title : true,
// bool / whether to display descriptionsshow_descr : true,
// bool / whether to display authorsshow_author : true,
// enables thumbnails navigation (requires elements poster or images)thumbs_nav : true,
// print type icons on thumbs if types are mixedtn_icons : true,
// whether to hide thumbs nav on lightbox opening - bool or int (related to browser's smaller side)tn_hidden : 500,
// width of the thumbs for the standard lightboxthumbs_w : 110,
// height of the thumbs for the standard lightboxthumbs_h : 110,
// attribute containing thumb URL to use or false to use thumbs makerthumb_attr : false,
// script baseurl to create thumbnails (use src=%URL% w=%W% h=%H%)thumbs_maker_url: false,
// Allow the user to expand a resized image. true/falsefullscreen : true,
// resize mode of the fullscreen image - smart/fit/fillfs_img_behavior : 'fit',
// when directly open in fullscreen mode - bool or int (related to browser's smaller side)fs_only : 500,
// whether to trigger or nor browser fullscreen modebrowser_fs_mode : true,
// boolsocials : true,
// bool / allow text hidingtxt_toggle_cmd : true,
// bool / whether to add download buttondownload : true,
// bool / Allow touch interactions for mobile (requires AlloyFinger)touchswipe : true,
// bool / Allow elements navigation with mousewheelmousewheel : true,
// enable modal mode (no closing on overlay click)modal : false,
// whether to avoid right click on lightboxrclick_prevent : false
});
LC Lightbox-jquery Lightbox 插件的 github 地址为:https://github.com/LCweb-ita/LC-Lightbox-LITE
| 演示地址 | 下载地址 |
专业提供WordPress主题安装、深度汉化、加速优化等各类网站建设服务,详询在线客服!
