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