don't set hash onload

This commit is contained in:
j 2025-04-27 11:46:42 +01:00
parent a6e76776cc
commit e48a1415a6

View file

@ -217,7 +217,7 @@ function loadGallery(images, idx, main, thumbnails) {
}
})
function updateGallery(index) {
function updateGallery(index, init) {
mainImage.src = images[index].src.replace('_display', '_thumbnail');
setTimeout(() => {
mainImage.src = images[index].src;
@ -253,12 +253,14 @@ function loadGallery(images, idx, main, thumbnails) {
}
prevBtn.disabled = index === 0;
nextBtn.disabled = index === images.length - 1;
if (!init) {
if (idx == 'inline') {
document.location.hash = `#${index + 1}`
} else {
document.location.hash = `#${idx + 1}/${index + 1}`
}
}
}
function createThumbnails() {
images.forEach((img, index) => {
@ -299,7 +301,7 @@ function loadGallery(images, idx, main, thumbnails) {
};
idx != 'inline' && createThumbnails();
updateGallery(currentIndex);
updateGallery(currentIndex, true);
const imagesIndex = images.map(img => img.src);
return {