Responsive Lightbox Gallery With Pure JavaScript And CSS3 – lightGallery

Category: Gallery , Javascript , Modal & Popup , Recommended | September 20, 2023
Author:sachinchoolur
Views Total:207 views
Official Page:Go to website
Last Update:September 20, 2023
License:MIT

Preview:

Responsive Lightbox Gallery With Pure JavaScript And CSS3 – lightGallery

Description:

The Vanilla JavaScript Version of the lightGallery jQuery plugin.

lightGallery.js is a responsive, touch-enabled, dependency-free JavaScript lightbox gallery library that enables you to present various types of media (images, videos, etc) in a fullscreen, scalable, navigatable, shareable, downloadable, and CSS3 animated gallery popup.

More Features:

  • 20+ transition animations.
  • Auto play when images loaded.
  • Infinite looping.
  • Supports youtube & vimeo videos, not just images.
  • Touch swipe support.
  • Pinch to zoom.
  • Virtual slides.
  • Image captions & descriptions support.
  • Arrows, thumbnails, and keyboard navigation.
  • Cross browser. Supports all major browsers.
  • Easing options support.
  • Multiple instances on one page.
  • Works with React, Angular, and Vue.js.
  • And much more.

Table Of Contents:

How To Use It:

1. Load the core stylesheet lightgallery.css in the head section of the document.

<!-- All In One -->
<link rel="stylesheet" href="css/lightgallery-bundle.css" />
<!-- OR -->
<link rel="stylesheet" href="css/lightgallery.css" />
<!-- Optional Plugin Stylesheet -->
<link rel="stylesheet" href="css/lg-autoplay.css" />
<link rel="stylesheet" href="css/lg-comments.css" />
<link rel="stylesheet" href="css/lg-fullscreen.css" />
<link rel="stylesheet" href="css/lg-medium-zoom.css" />
<link rel="stylesheet" href="css/lg-pager.css" />
<link rel="stylesheet" href="css/lg-relative-caption.css" />
<link rel="stylesheet" href="css/lg-rotate.css" />
<link rel="stylesheet" href="css/lg-share.css" />
<link rel="stylesheet" href="css/lg-thumbnail.css" />
<link rel="stylesheet" href="css/lg-transitions.css" />
<link rel="stylesheet" href="css/lg-video.css" />
<link rel="stylesheet" href="css/lg-zoom.css" />

2. Load the core JavaScript lightgallery.js and OPTIONAL plugin of your choice at the end of the document.

<!-- Core -->
<script src="lightgallery.umd.js"></script>
<!-- Optional Plugins -->
<script src="plugins/autoplay/lg-autoplay.umd.js"></script>
<script src="plugins/comment/lg-comment.umd.js"></script>
<script src="plugins/fullscreen/lg-fullscreen.umd.js"></script>
<script src="plugins/hash/lg-hash.umd.js"></script>
<script src="plugins/mediumZoom/lg-medium-zoom.umd.js"></script>
<script src="plugins/pager/lg-pager.umd.js"></script>
<script src="plugins/relativeCaption/lg-relative-caption.umd.js"></script>
<script src="plugins/rotate/lg-rotate.umd.js"></script>
<script src="plugins/share/lg-share.umd.js"></script>
<script src="plugins/thumbnail/lg-thumbnail.umd.js"></script>
<script src="plugins/video/lg-video.umd.js"></script>
<script src="plugins/zoom/lg-zoom.umd.js"></script>

3. The required HTML structure for the gallery lightbox. All possible attributes:

  • data-disqus-identifier: Disqus page identifier.
  • data-disqus-url: Disqus page url.
  • data-download-url: Download url for your image/video. Pass false if you want to hide the download button.
  • data-facebook-share-url: Facebook share URL. Specify only if you want to provide separate share URL for the specific slide. By default, current browser URL will be taken.
  • data-fb-html: Facebook comments body html.
  • data-iframe: Set true is you want to open your url in an iframe
  • data-iframe-title: Title for iframe
  • data-pinterest-share-url: 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
  • data-pinterest-text: Description for Pinterest post
  • data-poster: Poster image for your video
  • data-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.
  •  data-sizes: srcset sizes
  • data-slide-name: Custom slide name to use in the url when hash plugin is enabled.
  • data-sources: Source attributes for the picture element.
  • data-src: URL of the media
  • data-srcset: srcset attribute values
  • data-sub-html: id or class name of an object(div) which contain your sub html.
  • data-sub-html-url: URL of the file which contain your sub html.
  • data-thumb: Thumbnail url.
  • thumb: Title attribute for the video.
  • data-tweet-text: Tweet text
  • data-twitter-share-url: 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.
  • data-video Video source.
  • data-width: Actual size of the image in px. used in zoom plugin to see the actual size of the image when you doubleclick on the image.
<ul id="lightgallery" class="list-unstyled row">
  <li data-responsive="img/1-375.jpg 375, img/1-480.jpg 480, img/1.jpg 800" 
      data-src="img/1-1600.jpg" 
      ata-sub-html="<h4>Image Description</p>" 
      data-pinterest-text="Pin it1" 
      data-tweet-text="share on twitter 1">
      <a href="">
        <img class="img-responsive" src="img/thumb-1.jpg">
      </a>
  </li>
  <li data-responsive="img/2-375.jpg 375, img/2-480.jpg 480, img/2.jpg 800" 
      data-src="img/2-1600.jpg" 
      ata-sub-html="<h4>Image Description</p>" 
      data-pinterest-text="Pin it1" 
      data-tweet-text="share on twitter 2">
      <a href="">
        <img class="img-responsive" src="img/thumb-2.jpg">
      </a>
  </li>
  <li data-responsive="img/3-375.jpg 375, img/3-480.jpg 480, img/3.jpg 800" 
      data-src="img/3-1600.jpg" 
      ata-sub-html="<h4>Image Description</p>" 
      data-pinterest-text="Pin it1" 
      data-tweet-text="share on twitter 3">
      <a href="">
        <img class="img-responsive" src="img/thumb-3.jpg">
      </a>
  </li>
  <a
    data-lg-size="1280-720"
    data-video='{"source": [{"src":"/videos/video1.mp4", "type":"video/mp4"}], "tracks": [{"src": "{/videos/title.txt", "kind":"captions", "srclang": "en", "label": "English", "default": "true"}], "attributes": {"preload": false, "controls": true}}'
    data-poster="/images/demo/youtube-video-poster.jpg"
    data-sub-html="<h4>'Peck Pocketed' by Kevin Herron | Disney Favorite</h4>"
  >
    <img
        width="300"
        height="100"
        class="img-responsive"
        src="/images/demo/youtube-video-poster.jpg"
    />
  </a>
</ul>

4. Initialize the lightGallery with default options.

lightGallery(document.getElementById('lightgallery'));

5. Load optional plugins.

lightGallery(document.getElementById('lightgallery'),{
  plugins: [lgAutoplay, lgComment, lgFullscreen, lgHash, lglgMediumZoom, lgPager, lgRotate, lgShare, lgVideo, lgZoom, lgThumbnail],
});

6. All configuration options to customize the lightGallery.

lightGallery(document.getElementById('lightgallery'),{
  // options here
});
/**
 * Type of transition between images.
 */
mode: 'lg-slide' | 'lg-fade' | 'lg-zoom-in' | 'lg-zoom-in-big' | 'lg-zoom-out' | 'lg-zoom-out-big' | 'lg-zoom-out-in' | 'lg-zoom-in-out' | 'lg-soft-zoom' | 'lg-scale-up' | 'lg-slide-circular' | 'lg-slide-circular-vertical' | 'lg-slide-vertical' | 'lg-slide-vertical-growth' | 'lg-slide-skew-only' | 'lg-slide-skew-only-rev' | 'lg-slide-skew-only-y' | 'lg-slide-skew-only-y-rev' | 'lg-slide-skew' | 'lg-slide-skew-rev' | 'lg-slide-skew-cross' | 'lg-slide-skew-cross-rev' | 'lg-slide-skew-ver' | 'lg-slide-skew-ver-rev' | 'lg-slide-skew-ver-cross' | 'lg-slide-skew-ver-cross-rev' | 'lg-lollipop' | 'lg-lollipop-rev' | 'lg-rotate' | 'lg-rotate-rev' | 'lg-tube';
/**
 * Slide animation CSS easing property
 */
easing: string;
/**
 *Transition duration (in ms).
 */
speed: number;
/**
 * If you are using lightGallery for commercial projects, you need to purchase a commercial license
 * to get the license key. For projects that are compatible with GPLv3 license,
 * please contact us for getting a license key at <a href="mailto:[email protected]">[email protected]</a>.
 * If you want to test lightGallery before purchasing a commercial license, you can
 * use `0000-0000-000-0000` as a temporary license key
 */
licenseKey: string;
/**
 * Height of the gallery.
 * example '100%' , '300px'
 */
height: string;
/**
 * Width of the gallery.
 * example '100%' , '300px'
 */
width: string;
/**
 * Add custom class for gallery container
 * This can be used to set different style for different galleries
 */
addClass: string;
/**
 * Start animation class for the gallery.
 * @description
 * <ul>
 * <li>This can be used to change the zoom effect when the image is loaded</li>
 * <li>This is also applied when navigating to new slides</li>
 * <li>startClass will be empty zoomFromOrigin is true.</li>
 * </ul>
 */
startClass: string;
/**
 * Enable zoom from origin effect.
 * @description You need to know the original image size upfront and provide it via data-lg-size attribute as <code> data-lg-size="1920-1280</code>"
 *
 * If you don't know, the size of a few images in the list, you can skip the data-lg-size attribute for the particular slides,
 * lightGallery will show the default animation if data-lg-size is not available
 *
 * If you are using responsive images,
 * you can pass a comma separated list of sizes combined with a max-width (up to what size the particular image should be used)
 *
 * example -
 * <code> data-lg-size="240-160-375, 400-267-480, 1600-1067"
 * data-responsive="img-240.jpg 375, img-400.jpg 480"
 * data-src="img-1600.jpg" </code>
 *
 * In the above example, upto 375 width img.240.jpg and lg-size 240-160 will be used.
 * Similarly, upto 480 pixel width size 400-267 and img-400.jpg will be used
 * And above 480, lg-size 1600-1067 and img-1600.jpg will be used
 *
 * <ul>
 * <li>At the moment, zoomFromOrigin options is supported only for image slides.</li>
 * <li>Will be false if dynamic option is enabled or galleryID found in the URL.</li>
 * <li>startClass will be empty if zoomFromOrigin is true to avoid css conflicts.</li>
 * </ul>
 */
zoomFromOrigin: boolean;
/**
 * Zoom from image animation duration
 */
startAnimationDuration: number;
/**
 * Backdrop transition duration.
 * Note - Do not change the value of backdrop via css.
 */
backdropDuration: number;
/**
 * Configure where the gallery should be appended.
 * Useful to create inline galleries and more
 */
container: HTMLElement;
/**
 * Delay for hiding gallery controls in ms.
 * Pass <code>0</code> if you don't want to hide the controls
 */
hideBarsDelay: number;
/**
 * Delay in hiding controls for the first time when gallery is opened
 */
showBarsAfter: number;
/**
 * Delay slide transitions.
 * @description This is useful if you want to do any action in the current slide before moving to next slide.
 * <section>
 * For example, fading out the captions before going to next slide.
 * <code>.lg-slide-progress</code> class name is added to the current slide immediately after calling the slide method.
 * But transition begins only after the delay
 * </section>
 */
slideDelay: number;
/**
 * Support legacy browsers
 * @description Currently this is used only for adding support to srcset attribute via picturefill library
 * If true lightGallery will show warning message to include picturefill library
 */
supportLegacyBrowser: boolean;
/**
 * If true, toolbar, captions and thumbnails will not overlap with media element
 * This will not effect thumbnails if animateThumb is false
 * Also, toggle thumbnails button is not displayed if allowMediaOverlap is false
 * <section>
 * Note - Changing the position of the media on every slide transition creates a flickering effect.
 * Therefore, The height of the caption is calculated dynamically, only once based on the first slide caption.
 * </section>
 * <section>
 * if you have dynamic captions for each media,
 * you can provide an appropriate height for the captions via allowMediaOverlap option
 * </section>
 */
allowMediaOverlap: boolean;
/**
 * Video max size.
 * @description This can be over-written by passing specific size via data-lg-size attribute
 * Recommended video resolution and & aspect ratios <a href="https://support.google.com/youtube/answer/6375112">https://support.google.com/youtube/answer/6375112</a>
 */
videoMaxSize: string;
/**
 * Height of the caption for calculating allowMediaOverlap positions
 * Note - this is only used to find the position of media item if allowMediaOverlap is true.
 * Not for setting height of the captions
 * Set 0 if you want to calculate the height of captions dynamically
 */
defaultCaptionHeight: number;
/**
 * aria-labelledby attribute fot gallery
 */
ariaLabelledby: string;
/**
 * aria-describedby attribute for gallery
 */
ariaDescribedby: string;
/**
 * If false user won't be abel to close the gallery at all
 * This is useful for creating inline galleries.
 */
closable: boolean;
/**
 * allows vertical drag/swipe to close gallery
 * <code>false</code> if option <code>closable</code> is <code>false</code>
 */
swipeToClose: boolean;
/**
 * allows clicks on black area to close gallery.
 */
closeOnTap: boolean;
/**
 * If false, close button won't be displayed.
 * Useful for creating inline galleries.
 */
showCloseIcon: boolean;
/**
 * Show maximize icon.
 * Useful for creating inline galleries.
 */
showMaximizeIcon: boolean;
/**
 * If false, will disable the ability to loop back to the beginning of the gallery from the last slide.
 */
loop: boolean;
/**
 * Whether the LightGallery could be closed by pressing the "Esc" key.
 */
escKey: boolean;
/**
 * Enable keyboard navigation
 */
keyPress: boolean;
/**
 * If false, prev/next buttons will not be displayed.
 */
controls: boolean;
/**
 * Enable slideEnd animation
 */
slideEndAnimation: boolean;
/**
 * If true, prev/next button will be hidden on first/last image.
 */
hideControlOnEnd: boolean;
/**
 * Hide scrollbar when gallery is opened
 * @version V2.5.0
 */
hideScrollbar: boolean;
/**
 * ability to navigate to next/prev slides on mousewheel
 */
mousewheel: boolean;
/**
 * Option to get captions from alt or title tags.
 */
getCaptionFromTitleOrAlt: boolean;
/**
 * control where the sub-html should be appended.
 */
appendSubHtmlTo: '.lg-sub-html' | '.lg-item';
/**
 * Set to true if the selector in "data-sub-html" should use the current item as its origin.
 */
subHtmlSelectorRelative: boolean;
/**
 * number of preload slides
 * @description will exicute only after the current slide is fully loaded.
 * for example, if you click on 4th image and if preload = 1 then 3rd slide and 5th
 * slide will be loaded in the background after the 4th slide is fully loaded..
 * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.
 */
preload: number;
/**
 * Control how many slide items should be kept in dom at a time
 * @description To improve performance by reducing number of gallery items in the dom,
 * lightGallery keeps only the lowest possible number of slides in the dom at a time.
 * This has a minimum value of 3
 */
numberOfSlideItemsInDom: number;
/**
 * Show Content once it is fully loaded
 */
showAfterLoad: boolean;
/**
 * Custom selector property instead of direct children.
 * @description Based on your markup structure, you can specify custom selectors to fetch media data for the gallery
 * Pass "this" to select same element
 * You can also pass HTMLCollection directly
 * Example - '.my-selector' | '#my-selector' | this | document.querySelectorAll('.my-selector')
 */
selector: string | HTMLCollection;
/**
 * By default selector element relative to the current gallery.
 * Instead of that you can tell lightGallery to select element relative to another element.
 * Example - '.my-selector-container' | '#my-selector-container'
 * In the code this become selector =  document.querySelector(this.s.selectWithin ).querySelectorAll(this.s.selector);
 */
selectWithin: string;
/**
 * Custom html for next control
 */
nextHtml: string;
/**
 * Custom html for prev control
 */
prevHtml: string;
/**
 * specify which slide should load initially
 */
index: number;
/**
 * Set width for iframe.
 */
iframeWidth: string;
/**
 * Set width for iframe.
 */
iframeHeight: string;
/**
 * Enable download button.
 * @description By default download url will be taken from data-src/href attribute but it supports only for modern browsers.
 * If you want you can provide another url for download via data-download-url.
 * pass false in data-download-url if you want to hide download button for the particular slide.
 */
download: boolean;
/**
 * Whether to show total number of images and index number of currently displayed image.
 */
counter: boolean;
/**
 * Where the counter should be appended
 */
appendCounterTo: string;
/**
 * By setting the swipeThreshold (in px) you can set how far the user must swipe for the next/prev image.
 */
swipeThreshold: number;
/**
 * Enables swipe support for touch devices
 */
enableSwipe: boolean;
/**
 * Enables desktop mouse drag support
 */
enableDrag: boolean;
/**
 * LightGallery can be instantiated and launched programmatically by setting this option to true and populating dynamicEl option (see below) with the definitions of images.
 */
dynamic: false;
/**
 * An array of objects (src, iframe, subHtml, thumb, poster, responsive, srcset sizes) representing gallery elements.
 */
dynamicEl: GalleryItem[];
/**
 * Fetch custom properties from the selector
 * @description this is useful for plugin development
 * By default lightGallery fetches and store all the props selectors to
 * reduce frequent dom interaction for fetching props every time.
 *
 * If you need any addition data to be fetched and stored in the galleryItems variable,
 * you can do this just by passing the prop names via extraProps
 * @example
 * HTML:
 * <div id="lightGallery">
 *     <a href="a.jpg" data-custom-prop="abc"><img src="thumb.jpg" /></a>
 *     <a href="a.jpg" data-custom-prop="xyz"><img src="thumb.jpg" /></a>
 * </div>
 * JS:
 * lightGallery(document.getElementById('lightGallery'), {
 *     extraProps: ['customProp']
 * })
 * // Note - If you are using dynamic mode, you can pass any custom prop in the galleryItem
 * lightGallery(document.getElementById('lightGallery'), {
 *     dynamic: true,
 *     dynamicEl: [{
 *         src: 'img/img1.jpg',
 *         customProp:'abc',
 *     }]
 * })
 *
 */
extraProps: string[];
/**
 * Option to fetch different thumbnail image other than first image
 * @description If you want to use external image for thumbnail,
 * add the path of that image inside "data-" attribute
 * and set value of this option to the name of your custom attribute.
 *
 * @example
 * <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'
 * })
 */
exThumbImage: string;
/**
 * Function to detect mobile devices
 */
isMobile?: () => boolean;
/**
 * Separate settings for mobile devices
 * @description Note - this is applied only at the time of loading
 * by default controls and close buttons are disabled on mobile devices.
 * use this options if you want to enable them or change any other settings for mobile devices
 * Note - mobileSettings does not merge default values, You need to provide all mobileSettings including default values
 */
mobileSettings: {
  controls: false,
  showCloseIcon: false,
  download: false,
};

7. Default options of plugins.

// autoplay
autoplay: false,
pause: 5000,
progressBar: true,
fourceAutoplay: false,
autoplayControls: true,
appendAutoplayControlsTo: '.lg-toolbar',
slideShowAutoplay: false,
slideShowInterval: 5000,
// comment
commentBox: false,
// fullscreen
fullScreen: true,
// hash
hash: true,
galleryId: '1',
customSlideName: false,
// medium zoom
mediumZoom: true,
backgroundColor: '#000',
margin: 40,
// pager
pager: true,
// place captions relative to the media
relativeCaption: true,
// rotate
flipHorizontal: true,
flipVertical: true,
rotate: true,
rotateSpeed: 400,
rotateLeft: true,
rotateRight: true,
// social share
share: true,
facebook: true,
facebookDropdownText: 'Facebook',
twitter: true,
twitterDropdownText: 'Twitter',
pinterest: true,
pinterestDropdownText: 'Pinterest',
additionalShareOptions: [],
// thumbnail
thumbnail: true,
animateThumb: true,
alignThumbnails: 'middle', // 'left' or 'middle' or 'right'
currentPagerPositio: : 'middle', // 'left' or 'middle' or 'right'
appendThumbnailsTo: '.lg-components',
thumbWidth: 100,
thumbContHeight: 100,
thumbMargin: 5,
toggleThumb: true,
enableThumbDrag: true,
enableThumbSwipe: true,
thumbnailSwipeThreshold: 10,
loadYoutubeThumbnail: true,
youtubeThumbSize: 1,
// Vimeo thumbnails
showThumbnailWithPlayButton: false,
showVimeoThumbnail: true,
// video
autoplayFirstVideo: true,
autoplayVideoOnSlide: false,
gotoNextSlideOnVideoEnd: true,
videojs: false, // uses video.js library
videojsOptions: {}, // requires video.js
youtubePlayerParams: false,
vimeoPlayerParams: false,
wistiaPlayerParams: false,
// zoom
scale: 1,
zoom: true,
actualSize: true,
actualSizeIcons: {zoomIn: 'lg-zoom-in', zoomOut: 'lg-zoom-out'}
enableZoomAfter: 300,
showZoomInOutIcons: false,

8. API methods.

const el = document.getElementById('lightgallery');
const instance = lightGallery(el);
// goto a specific slide (slide 2)
instance.slide(1);
// goto the next slide
instance.goToNextSlide();
// back to the previous slide
instance.goToPrevSlide();
// refresh
instance.refresh();
// destroy the instance
instance.destroy();
// open gallery
instance.openGallery(slideIndex);
// close gallery
instance.closeGallery();
// maximize minimize inline gallery
instance.toggleMaximize();
// update slides
instance.updateSlides(galleryItems, Index);

9. Event handlers:

el.addEventListener('lgInit', function(e){
  // event.detail.instance
});
el.addEventListener('lgBeforeOpen', function(e){
  // do something
});
el.addEventListener('lgAfterOpen', function(e){
  // do something
});
el.addEventListener('lgAfterAppendSlide', function(e){
  // event.detail.index - Index of the slide
});
el.addEventListener('lgAfterAppendSubHtml', function(e){
  // event.detail.index - Index of the slide
});
el.addEventListener('lgSlideItemLoad', function(e){
  // event.detail.index - Index of the slide
});
el.addEventListener('lgHasVideo', function(e){
  // event.detail.hasPoster - True if video has poster
  // event.detail.html5Video - HTML5 video source if available
  // event.detail.index - Index of the slide,
  // event.detail.isFirstSlide - True for first slide
  // event.detail.src - Video source
});
el.addEventListener('lgBeforeSlide', function(e){
  // event.detail.prevIndex - Index of the previous slide
  // event.detail.index - Index of the slide
  // event.detail.fromTouch - true if slide function called via touch event or mouse drag
  // event.detail.fromThumb - true if slide function called via thumbnail click
});
el.addEventListener('lgAfterSlide', function(e){
  // event.detail.prevIndex - Index of the previous slide
  // event.detail.index - Index of the slide
  // event.detail.fromTouch - true if slide function called via touch event or mouse drag
  // event.detail.fromThumb - true if slide function called via thumbnail click
});
el.addEventListener('lgBeforeNextSlide', function(e){
  // event.detail.index - Index of the slide
  // event.detail.fromTouch - true if slide function called via touch event or mouse drag
});
el.addEventListener('lgBeforePrevSlide', function(e){
  // event.detail.index - Index of the slide
  // event.detail.fromTouch - true if slide function called via touch event or mouse drag
});
el.addEventListener('lgPosterClick', function(e){
  // do something
});
el.addEventListener('lgDragStart', function(e){
  // do something
});
el.addEventListener('lgDragMove', function(e){
  // do something
});
el.addEventListener('lgDragEnd', function(e){
  // do something
});
el.addEventListener('lgContainerResize', function(e){
  // event.detail.index - Index of the slide
});
el.addEventListener('lgBeforeClose', function(e){
  // do something
});
el.addEventListener('lgAfterClose', function(e){
  // do something
});

Changelog:

v2.7.2 (09/20/2023)

  • Add alt tag for thumbnails if available
  • Infinite zoom (Zoom beyond actual size) support
  • enable the close button on mobile for iframe
  • fix(zoom): zoom in and out not happening when clicked too fast
  • feat(strings): make error message customizable

v2.7.1 (01/11/2023)

  • Support for YouTube nocookie
  • Bugfixes

v2.7.0 (10/09/2022)

  • Add support for angular 13 and 14
  • Big fix – Zoom button is disabled when clicking too fast

v2.6.1 (09/14/2022)

  • Bug fix – grayed zoom icon

v2.6.0 (08/29/2022)

  • Refactor zoom module
  • Fix issue – Blurry images when zooming on iOS devices
  • Make lightGallery compatible with react 18 strict mode
  • Next / previous button not working with overlapping caption

v2.5.0 (06/13/2022)

  • New VimeoThumbnail plugin that automatically loads thumbnail for Vimeo videos
  • Private video support for Vimeo videos
  • Videojs custom theme support
  • Trap focus within lightGallery
  • Option to hide the scrollbar
  • Option to skip scrolling back to the original position on close
  • Bug fixes

v2.4.0 (01/29/2022)

  • Add i18n support
  • Add rotate callback for Angular, React, and Vue components
  • Add events for autoplay actions autoplay, autoplayStart and autoplayStop
  • Bug Fixes

v2.3.0 (10/28/2021)

  • Add URL params support for YouTube videos.
  • Add URL parameters support for Vimeo videos
  • Improve video autoplay experience
  • Automatically load poster images for youtube videos
  • Add iframe max-width max-height options
  • Removed showAfterLoad option as it is already managed via startClass
  • Bug fixes/improvements

v2.2.1 (09/05/2021)

  • Fixed: Mixed content Uncaught TypeError

v2.2.0 (08/20/2021)

  • Make rotate speed configurable via rotateSpeed option
  • Emit events on rotate and flip
  • Add video tracks support
  • Add an option set name for the downloaded file
  • Add an option to append captions to the outer div. By setting appendSubHtmlTo to .lg-outer, the main gallery portion and captions can be placed side by side
  • Bugs fixed
  • This release changes the HTML structure a little bit – class .lg has been renamed to .lg-content and lg-inner and controls have been moved inside .lg-content. This will affect your existing setup only if you have made any customization
  • Download button for video and iframes slides is not disabled by default. You need explicitly pass data-download-url=”false” if you need to disable the download button.
  • Settings width and height have been removed

v2.1.8 (07/08/2021)

  • Bug fixes and improvements

v2.1.7 (06/30/2021)

  • Bug fixes

v2.1.6 (06/29/2021)

  • Bugfix: Wrong button gets disabled on first and last images in gallery (Previous instead of Next)

v2.1.5 (06/12/2021)

  • New relativeCaptions plugin to place captions relative to the media

v2.1.4 (06/11/2021)

  • Fixed: Srcset segments will be converted to html attributes

v2.1.3 (06/07/2021)

  • Fixed: The image is shifted under certain circumstances

v2.1.2 (06/06/2021)

  • Add lit component support
  • Bugfix – Fix setting selector type

v2.1.1 (06/02/2021)

  • Bug fixes

v2.1.0 (05/28/2021)

  • Add refresh method
  • Allow plugins to modify core settings
  • New plugin for medium like zoom experience
  • Add elementClassNames prop for react component
  • Bug fixes

v2.0.0 (05/25/2021)

  • Completely re-wrote from scratch in typescript
  • Removed jQuery dependency
  • Available for React, Vue.js, and Angular
  • Moved all modules to the main repo for better maintainability
  • Dropped IE 8 and 9 support. Let me know if you still need support for IE 8 and 9. I’ll consider adding a plugin to add support if there is enough demand
  • Separated plugin and transitions CSS from the core CSS file
  • Pinch to zoom
  • Virtual slides
  • Swipe to close
  • Zoom from the origin
  • Inline gallery
  • Next-generation image formats support(webp, JPEG XL). etc
  • Better customizability
  • Better performance on mobile devices.
  • Dynamically add, remove slides while the gallery is open
  • Comment interface
  • and much more.

v1.4.1beta (10/29/2020)

  • Fix vimeo embed url in gallery

v1.4.0 (10/14/2020)

  • Add option to turn off hiding toolbar and controls
  • Add supportLegacyBrowser option
  • Better error messaging
  • Minor bug fixes

v1.3.1 (09/19/2020)

  • Fix issue – Horizontal and vertical flip buttons class names are interchanged

v1.3.0 (09/01/2020)

  • Add rotate module

v1.2.1 (08/18/2020)

  • Remove unnecessary outline from the outer element.

v1.2.0 (07/29/2020)

  • Accessibility improvements

v1.1.1 (09/03/2018)

  • lg-thumbnail bug fix

You Might Be Interested In:


3 thoughts on “Responsive Lightbox Gallery With Pure JavaScript And CSS3 – lightGallery

  1. Daniel

    Great Lightbox! Just one question: How do I add several images to a slideshow while having only one thumbnail?
    I’d really appreciate some help 🙂

    Reply
  2. wy07

    Love the Lightbox! May I know how to create more than 1 gallery in a single page on WordPress? Am using tabs so each tab will have one gallery. Look forward to your reply. Thank you.

    Reply

Leave a Reply