Dynamic variables

LightGallery can be instantiated and launched programmatically by setting dynamic option to true and populating dynamicEl option by passing array of objects representing the gallery elements. more info.

Available options

Name Description
alt alt attribute for the image
disqusIdentifier Disqus page identifier

Please refer official disqus documentation for more info

disqusUrl Disqus page url

Please refer official disqus documentation for more info

download Name of the file after it is downloaded.

The HTML value of the download attribute. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.). More info

downloadUrl Download url for your image/video.

Pass false if you want to disable the download button.

facebookShareUrl Facebook share URL.

Specify only if you want to provide separate share URL for the specific slide. By default, current browser URL is taken.

fbHtml Facebook comments body html

Please refer facebook official documentation for generating the HTML markup


<div
     class="fb-comments"
     data-href="https://www.lightgalleryjs.com/demos/comment-box/#facebook-comments-demo"
     data-width="400"
     data-numposts="5">
</div>
iframe Set true is you want to open your url in an iframe
iframeTitle Title for iframe
pinterestShareUrl Pinterest share URL.

Specify only if you want to provide separate share URL for the specific slide. By default, current browser URL will be taken. Note?: Pinterest requires absolute URL

pinterestText Description for Pinterest post.
poster Poster url
responsive List of images and viewport's max width separated by comma.

Ex?: img/1-375.jpg 375, img/1-480.jpg 480, img/1-757.jpg 757.

sizes srcset sizes attribute for the main image
slideName Custom slide name to use in the url when hash plugin is enabled
sources Source attributes for the picture element
src url of the media
srcset srcset attribute values for the main image
subHtml Caption for the slide

You can either pass the HTML markup or the ID or class name of the element which contains the captions

subHtmlUrl url of the file which contain the sub html.

Note - Does not support Internet Explorer browser

thumb Thumbnail url

By default lightGallery uses the image inside gallery selector as thumbnail. But, If you want to use external image for thumbnail, pass the thumbnail url via any data attribute and pass the attribute name via exThumbImage option


<div id="lightGallery">
    <a href="a.jpg" data-external-thumb-image="images/externalThumb.jpg" ><img src="thumb.jpg" /></a>
</div>

lightGallery(document.getElementById('lightGallery'), {
    exThumbImage: 'data-external-thumb-image'
})
title Title attribute for the video
tweetText Tweet text
twitterShareUrl Twitter share URL.

Specify only if you want to provide separate share URL for the specific slide. By default, current browser URL will be taken.

video Video source
width Actual size of the image in px.

This is used in zoom plugin to see the actual size of the image when double taped on the image.

Edit this page on GitHub