website/js/imgPreview.js
2021-03-24 23:19:18 +01:00

14 lines
No EOL
442 B
JavaScript

import * as basicLightbox from 'basiclightbox'
let images = document.querySelectorAll("img, .clickSpan");
for(let i = 0; i < images.length; i++){
let element = images[i];
if(!(element.getAttribute("data-noPreview") === "true")) {
element.onclick = () => {
const instance = basicLightbox.create(`
<img src="${element.getAttribute("src")}">
`);
instance.show();
}
}
}