document.querySelectorAll('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"]').forEach(link => {
const img = link.querySelector('img');
if (img && !link.dataset.pswpWidth) {
const tempImg = new Image();
tempImg.onload = function () {
link.setAttribute('data-pswp-width', this.naturalWidth);
link.setAttribute('data-pswp-height', this.naturalHeight);
};
tempImg.src = link.href;
}
});
Scroll Up
Défiler vers le hautDéfiler vers le haut