Fullscreen Lightbox Javascript Fullscreen Lightbox ,React Fullscreen Lightbox Vue

Vanilla JS Lightbox Documentation

Learn how to use the Vanilla JavaScript version of Fullscreen Lightbox.

Other props

disableLocalStorage

To improve the performance, the lightbox caches detected types in the local storage. To disable it, set the "disableLocalStorage" prop to "true".

fsLightbox.props.disableLocalStorage = true;

disableSlideshowLoop Pro

By default, the lightbox won't stop the slideshow at the last slide but let it loop over to the first slide. Set this prop to "true" to disable this behavior.

fsLightbox.props.disableSlideshowLoop = true;

exitFullscreenOnClose

By default, the lightbox won't exit the fullscreen on close. To change it, set the "exitFullscreenOnClose" prop to "true".

fsLightbox.props.exitFullscreenOnClose = true;

loadOnlyCurrentSource

By default, the lightbox loads 3 stage sources—previous, current, and next—after opening and after a slide change. If the "loadOnlyCurrentSource" prop is set to "true", the lightbox will load only the current source.

fsLightbox.props.loadOnlyCurrentSource = true;

maxYoutubeDimensions

The lightbox cannot detect maximum sizes of YouTube videos (however, by default it sets them to 1920 × 1080). To change them, you can use the "data-width" and "data-height" attributes.

<a
data-fslightbox
data-width="1000"
data-height="500"
href="https://www.youtube.com/watch?v=3nQNiWdeH2Q"
>YouTube</a>

Or using the "maxYoutubeDimensions" object prop.

fsLightbox.props.maxYoutubeDimensions = { width: 1920, height: 1080 };

sourceMargin

The lightbox adds vertical margin and, on desktop screens, horizontal margin to sources. The default value is five percent (0.05).

fsLightbox.props.sourceMargin = 0.01;

slideDistance

The distance between the slides visible during swiping—x * window.innerWidth (by default, 0.3).

fsLightbox.props.slideDistance = 0.5;

Customizing buttons Pro

To edit the properties of the toolbar and slide buttons, overwrite adequate props in an analogous way to the given example (there are 5 editable props for each button):

fsLightbox.props.toolbarButtons.thumbs = {
width: "17px",
height: "17px",
viewBox: "0 0 278 278",
d: "M0 0 H119.054 V119.054 H0 V0 z M158.946 0 H278 V119.054 H158.946 V0 z M158.946 158.946 H278 V278 H158.946 V158.946 z M0 158.946 H119.054 V278 H0 V158.946 z",
title: "Thumbnails"
};
fsLightbox.props.toolbarButtons.zoomIn.width = "20px";
fsLightbox.props.toolbarButtons.zoomOut.height = "22px";
fsLightbox.props.toolbarButtons.zoomIn.viewBox = "0 0 20 20";
fsLightbox.props.toolbarButtons.slideshow.start.width = "25px";
fsLightbox.props.toolbarButtons.slideshow.pause.width = "20px";
fsLightbox.props.toolbarButtons.fullscreen.enter.title = "Show";
fsLightbox.props.toolbarButtons.fullscreen.exit.title = "Stop";
fsLightbox.props.toolbarButtons.close.viewBox = "0 0 25 25";

fsLightbox.props.slideButtons.previous.width = "15px";
fsLightbox.props.slideButtons.next.width = "24px";

slideshowTime Pro

When the slideshow is turned on, the time that needs to pass to change the slide to the next one (in milliseconds).

fsLightbox.props.slideshowTime = 10000;

UIFadeOutTime Pro

The time after which the lightbox's UI fades out (in milliseconds). The prop may be set to "false" to disable the fade-out.

fsLightbox.props.UIFadeOutTime = 10000;

zoomIncrement Pro

The value that increases the source's scale on a click zoom (by default, 0.25—that is, the size of the source is increased by 25%).

fsLightbox.props.zoomIncrement = 0.5;

disableBackgroundClose

Disables the closing of the lightbox when the background is clicked.

fsLightbox.props.disableBackgroundClose = true;

showThumbsWithCaptions Pro

Preserve the display of captions when the thumbs are opened.

fsLightbox.props.showThumbsWithCaptions = true;
Look over the Fullscreen Lightbox open source plug-ins.