You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
930 B

function buildFancybox() {
$(".article-container section img").unwrap();
let images = Array.from($('.article-container section img'));
if (!images.length) return;
images.forEach(el => {
const src = $(el).attr("src");
const alt = $(el).attr("alt") || '';
$(el).after(`<a href="${src}" data-download-src="${src}" data-caption="${alt}" data-fancybox="gallery"><img src="${src}"/></a>`);
$(el).remove();
});
window.Fancybox.bind('[data-fancybox="gallery"]', {
Toolbar: {
display: [
"counter",
"zoom",
"slideshow",
"fullscreen",
"download",
"thumbs",
"close",
],
},
Image: {
zoom: false,
},
showClass: "fancybox-zoomIn",
hideClass: "fancybox-zoomOut",
});
}
buildFancybox();