Frontend: Fixed an issue when using the photography buttons.
This commit is contained in:
parent
7db9bd0771
commit
16f629df6a
1 changed files with 9 additions and 1 deletions
|
@ -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) {
|
function swipeCanva(advance) {
|
||||||
const width = window.innerWidth / 2;
|
const width = window.innerWidth / 2;
|
||||||
const animTranslate = advance ? [-width, width] : [width, -width];
|
const animTranslate = advance ? [-width, width] : [width, -width];
|
||||||
|
@ -46,7 +54,7 @@
|
||||||
duration: 300,
|
duration: 300,
|
||||||
easing: "easeInQuad",
|
easing: "easeInQuad",
|
||||||
complete: function () {
|
complete: function () {
|
||||||
index = advance ? index + 1 : index - 1;
|
index = advance ? advanceIndex() : backIndex();
|
||||||
photoDiv.style.transform = `translateX(${animTranslate[1]}px)`;
|
photoDiv.style.transform = `translateX(${animTranslate[1]}px)`;
|
||||||
anime({
|
anime({
|
||||||
targets: photoDiv,
|
targets: photoDiv,
|
||||||
|
|
Loading…
Add table
Reference in a new issue