fancybox
fancybox copied to clipboard
Customize when using Vue.js
I am using VueJS with fancybox, everything works normally but when I try to have custom buttons, the buttons are not updated.
Anyone have idea what is going on? I am new to VueJS, so my understanding on the lifecycle is not that good.
mounted() {
$(document).ready(function() {
$('[data-fancybox]').fancybox({
buttons: [
'thumbs',
'close',
],
})
})
},
Vue creates and recreates the DOM elements, that might be your problem — the element with custom settings is replaced with another. Try adding a custom attribute (.attr('x-check', true) in jquery) and inspect the element to see if it sticks.
Btw you don't need the $(document).ready( wrapper inside mounted().