I have set up Silentbox in my project from the official documentation. and I am getting some errors..
here is the function:
Vue.prototype.$silentbox = {
/**
* Programatically open SilentBox overlay.
*
* @param {Object} image
*/
open: image => {
const OverlayClass = Vue.extend(__vue_component__);
const instance = new OverlayClass().$mount();
instance.$set(instance, 'visible', true);
instance.$set(instance, 'overlayItem', image); // Get the website body, so we can append false silentbox root to it later
const bodyRoot = document.getElementsByTagName('body')[0]; // Create false silentbox root
const silentboxRoot = document.createElement('div'); // Set ID to false silentbox root, so we can target it in some cases
silentboxRoot.setAttribute('id', 'silentbox--false-root'); // Register the elements
silentboxRoot.appendChild(instance.$el);
bodyRoot.appendChild(silentboxRoot);
instance.$on('closeSilentboxOverlay', () => {
// Remove and destroy the instance after closing.
silentboxRoot.remove();
instance.$destroy();
});
}
};