Fullscreen Lightbox Javascript Fullscreen Lightbox ,React Fullscreen Lightbox Vue

Vue Lightbox Documentation

Learn how to use the Vue version of Fullscreen Lightbox.

FAQ

A correct URL was passed but the lightbox displays the "Invalid file" message.

Most likely an external URL without the CORS enabled was used, so the lightbox cannot detect its type automatically. The issue can by solved by manually setting the source's type, or enabling the CORS of the given resource, or putting the file on the local server.

How to set props of components passed to the lightbox?

Instead of passing a component, pass an object with the component set to the "component" property and the props set to the "props" property. For example:

<FsLightbox
:sources="[{
component: CustomSource,
props: { exampleProp: "Example value." }
}]"
/>

The lightbox doesn't change the sources after the prop update.

The "sources" prop is not reactive. To determine how to update this prop, go to the "Updating props" section.

How to pause videos on a slide change?

It's possible only in the pro version as the "onSlideChange" event is not provided in the basic one. The following example describes how to pause both HTML and YouTube videos (so you might want to modify it if you are using only HTML or only YouTube videos):

<template>
<div>
<FsLightbox
:onSlideChange="pauseVideos"
/>
</div>
</template>

<script>
import FsLightbox from "fslightbox-vue";

export default {
components: { FsLightbox },
methods: {
pauseVideos (instance) {
var sources = instance.elements.sources;
for (var i = 0; i < sources.length; i++) {
var source = sources[i];
if (!source) {
continue;
}
if (source.tagName === "VIDEO") {
source.pause();
} else if (source.tagName === "IFRAME") {
source.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*");
}
}
}
}
};
</script>
Look over the Fullscreen Lightbox open source plug-ins.