2024-10-16 17:18:08 +00:00
|
|
|
let timing = 400;
|
2024-10-16 15:43:00 +00:00
|
|
|
let stacks = document.getElementsByClassName('stack');
|
|
|
|
|
|
|
|
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;
|
2024-10-16 17:18:08 +00:00
|
|
|
thisTarget.style.animation = `fade-out ${timing}ms ease-in forwards`;
|
2024-10-16 15:43:00 +00:00
|
|
|
|
|
|
|
setTimeout(() => {
|
2024-10-16 17:18:08 +00:00
|
|
|
thisTarget.style.animation = `fade-in ${timing}ms ease-out forwards`;
|
2024-10-16 15:43:00 +00:00
|
|
|
this.prepend(thisTarget);
|
2024-10-16 17:18:08 +00:00
|
|
|
// thisTarget.style = '';
|
|
|
|
|
2024-10-16 15:43:00 +00:00
|
|
|
}, timing);
|
2024-10-16 17:18:08 +00:00
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
thisTarget.style = '';
|
|
|
|
}, 2*timing);
|
2024-10-16 15:43:00 +00:00
|
|
|
}
|