mirror of
https://github.com/RetroDECK/RetroDECK-Website.git
synced 2024-11-21 22:45:39 +00:00
21 lines
655 B
JavaScript
21 lines
655 B
JavaScript
|
let timing = 2000;
|
||
|
|
||
|
// let stack = document.querySelector(".stack");
|
||
|
let stacks = document.getElementsByClassName('stack');
|
||
|
|
||
|
// [...stack.children].reverse().forEach(i => stack.append(i));
|
||
|
for (let i = 0; i < stacks.length; i++) {
|
||
|
[...stacks[i].children].reverse().forEach(j => stacks[i].append(j));
|
||
|
stacks[i].addEventListener("click", swap);
|
||
|
}
|
||
|
|
||
|
function swap(e) {
|
||
|
let thisTarget = e.target
|
||
|
if (!thisTarget.classList.contains('screenshot')) return;
|
||
|
thisTarget.style.animation = `swap ${timing}ms ease-in-out forwards`;
|
||
|
|
||
|
setTimeout(() => {
|
||
|
thisTarget.style.animation = "";
|
||
|
this.prepend(thisTarget);
|
||
|
}, timing);
|
||
|
}
|