Frontend: Fixed an issue when using the photography buttons.

This commit is contained in:
Yohan Boujon 2025-06-01 14:02:01 +02:00
parent 7db9bd0771
commit 16f629df6a

View file

@ -32,6 +32,14 @@
);
}
function backIndex() {
return index - 1 < 0 ? index : index - 1;
}
function advanceIndex() {
return index + 1 > photoList.length - 1 ? index : index + 1;
}
function swipeCanva(advance) {
const width = window.innerWidth / 2;
const animTranslate = advance ? [-width, width] : [width, -width];
@ -46,7 +54,7 @@
duration: 300,
easing: "easeInQuad",
complete: function () {
index = advance ? index + 1 : index - 1;
index = advance ? advanceIndex() : backIndex();
photoDiv.style.transform = `translateX(${animTranslate[1]}px)`;
anime({
targets: photoDiv,