don't set hash onload
This commit is contained in:
parent
a6e76776cc
commit
e48a1415a6
1 changed files with 8 additions and 6 deletions
|
@ -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,10 +253,12 @@ function loadGallery(images, idx, main, thumbnails) {
|
|||
}
|
||||
prevBtn.disabled = index === 0;
|
||||
nextBtn.disabled = index === images.length - 1;
|
||||
if (idx == 'inline') {
|
||||
document.location.hash = `#${index + 1}`
|
||||
} else {
|
||||
document.location.hash = `#${idx + 1}/${index + 1}`
|
||||
if (!init) {
|
||||
if (idx == 'inline') {
|
||||
document.location.hash = `#${index + 1}`
|
||||
} else {
|
||||
document.location.hash = `#${idx + 1}/${index + 1}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue