LC Lightbox - jQuery Plugin

Documentation

Initialization

Basic

Once files has been added to your webpage, you're ready to initialize LC Lightbox.
This is the most essential implementation, showing multiple images and using default lightbox settings:


	
<script type='text/javascript'>
$(document).ready(function() {
	var $obj = lc_lightbox('#lcl_elems_wrapper a');
});
</script>

By default title, data-lcl-txt and data-lcl-author attributes are fetched. They are optional.
Is also possible to change attribute names or use inner selectors (check options chapter to know more).

IMPORTANT: lc_lightbox() function returns the initialized instance ($obj), to be used in public methods.

Multiple Content Types
This feature is not available in LITE version

LC Lightbox supports multiple content types that can be mixed together.

  • Images
  • Youtube videos
  • Vimeo videos
  • Dailymotion videos
  • HTML5 videos
  • Iframes
  • HTML contents

Here's an example wrapping together all of them:



<!-- HTML contents to show -->

	
<script type='text/javascript'>
$(document).ready(function() {
	lc_lightbox('#lcl_elems_wrapper a');
});
</script>

HTML5 video note: You can specify multiple video extensions simply using multiple sources split by a semicolon.

HTML contents note: the source attribute must contain a selector pointing to contents wrapper.

Utility Attributes

There are several fixed attributes you can use to set custom element behaviors and to set specific data.
They are optional and have to be applied to target elements. For example:


Here's the list:

Attribute's nameDescription
data-lcl-typeForce an item type. Supported types: image - video - youtube - vimeo - dailymotion - html - iframe
data-lcl-outer-cmdTo be used only if lightbox uses inner commands. Use it (with any content) to force outer commads.
Could be handy to not cover any element's part
data-lcl-force-over-dataCustom threshold (in pixels) to keep side/under data. Is related to element sizes and by default is 400px.
Example: on a small screen, if image is smaller than 400px because of texts, they are moved over the picture
data-lcl-wDefines a custom element's maximum width. Could be an integer (pixels) or % or vw or vh value.
Is ignored for image elements
data-lcl-hDefines a custom element's maximum height. Could be an integer (pixels) or % or vw or vh value.
Is ignored for image elements
data-lcl-pathAbsolute file URL used by the download feature. Supported by image, HTML5 video and HTML element types
data-lcl-canonical-urlReference URL used by comment systems. Should be an unique URL bringing to the file.
It's unicity guarantees comments maintaining through your site pages.
data-lcl-posterImage URL to use as element's poster. It is used in thumbnails navigation and as proper poster in videos.
Can be used on any video source, iframe and HTML types.

Youtube supports also "auto" value: lightbox will directly use video's image taken from Youtube

Custom sizing notes regarding videos
Use both width and height to define a new aspect ratio, otherwise the default 16/9 ratio will be used

Custom sizing notes regarding html and iframe
Use both width and height to define a new aspect ratio, otherwise the missing parameter will be inherited from global sizing settings.
HTML elements don't have a minimum height
Live Elements Tracking

LC Lightbox can be initialized using a static DOM object or also specifying a selector (as done in previous examples).

There's a substantial differnce between these two systems: using a selector the plugin will keep listening to DOM structure.
Then DOM changes (eg. added or removed elements) will be managed on lightbox opening.

<script type='text/javascript'>
$(document).ready(function() {
	
	// static initialization 
	var $obj = $('#lcl_elems_wrapper a')
	lc_lightbox($obj);
	
	// dynamic initialization
	lc_lightbox('#lcl_elems_wrapper a');
});
</script>
Direct Array Initialization

You can also initialize LC Lightbox directly, passing an objects array with a predefined structure.
Here's an example using multi-type sources and also utility attributes.

<script type='text/javascript'>
$(document).ready(function() {
	
	var data = [
		{
			type			: 'image',
			src 			: 'image url',
			title			: 'the title',
			txt 			: 'the description',
			author			: 'the author',
			thumb			: 'smaller image URL to use in thumbs navinations'
			force_outer_cmd : true,
			download		: 'image path',
			canonical_url	: 'unique reference url'
		},
		{
			type	: 'video',
			src 	: 'html5 video url',
			width	: '50%',
			height	: '45%',
			poster	: 'image URL to use as video poster'
		},
	];
	
	var $instance = lc_lightbox(data);
	var index = 0;
	lcl_open($instance, index); // direct lightbox opening showing first element
});
</script>

Type names are: image, video, youtube, vimeo, dailymotion, html and iframe.
Other keys have been explained previously in this section.

Let's get in touch!

Features list

  • Elements Slideshow (manually or automatically initialized)
  • Thumbnails Navigation (with customizable sizes and optional data-type icon)
  • Effective Socials Share (with WhatsApp option on mobile)
  • Element Contents (title, description and author)
  • Images "right-click" protection
  • Show and mix multiple data type (Images - HTML5 video - youtube - vimeo - dailymotion - inline HTML - iframe)
  • Natively supports webp/avif images
  • Fullscreen mode
    • Covering only browser or entire screen space
    • Optionally forced under target screen sizes
    • Fullscreen-only mode
    • Image option to cover available space (cropping it) or to be completely shown
  • Elements direct download (not requiring PHP scripts)
  • Components Toggling (thumbnails and texts).
  • Thumbnails and texts optionally hidden by default under target screen sizes
  • Dynamic Elements Tracking
  • HTML support in element descriptions
  • 100% CSS Driven
  • (optional) Mousewheel and Keyboard elements navigation
  • Touch integrations
    • Swipe > navigate through elements
    • Double-tap > zoom-in image
    • Pinch-in and out > zoom-in and out image
  • Dev-oriented and well-documented methods & Events
  • SEO deeplinking system with browser-history management
  • Progressive images zoom
  • Comments integration (Disqus or Facebook Comments)
  • 4 layouts (text over element, under element or on right/left side)
  • (optional) closing button on corner position (for inner commands)
  • (optional) navigation buttons on middle position (for inner commands)
  • 7 preset show/hide animations
  • Automatic fallback on text over image on small screens or whether element becomes too small
  • 3 preset skins to be used and mixed on a single page (light, dark and minimal)
  • Code projected to be easily skinned via CSS
  • Dual commands position (inside and outside lightbox window)
  • Specific element behaviors
    • Forced outer commands
    • Custom element width (not for images)
    • Custom element height (not for images)
    • Custom element aspect ratio combining width & height (not for images)
  • Elements complete preload once page is loaded
  • Adapts to your page's code (you set how lightbox fetches contents from binded elements)
  • Full control on each animation/effect timing
  • Modal mode
  • Thumbnails script support (eg. easily integrates with Timthumb)
  • MUCH MORE! check 60+ lightbox options