Events
There are few events that you can listen for:
Prop | When fired? |
---|---|
onOpen | Every time instance is opened (both show and initialize). |
onClose | Every time instance is closed. |
onInit | When instance is opened for the first time. |
onShow | When opening instance after initial open. |
onSlideChange Pro | Called on slide change. |
Just pass a callback function to specific prop. Example:
<template>
<FsLightbox
:toggler="toggler"
:sources="[some sources]"
:onSlideChange="action"
/>
</template>
<script>
import FsLightbox from "fslightbox-vue";
export default {
components: { FsLightbox },
data() {
return {
toggler: false,
}
},
methods: {
action(instance) {
console.log(instance);
}
}
};
</script>
<FsLightbox
:toggler="toggler"
:sources="[some sources]"
:onSlideChange="action"
/>
</template>
<script>
import FsLightbox from "fslightbox-vue";
export default {
components: { FsLightbox },
data() {
return {
toggler: false,
}
},
methods: {
action(instance) {
console.log(instance);
}
}
};
</script>