2024-10-17 14:47:58 +00:00
|
|
|
let timing = 250;
|
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));
|
2024-10-17 14:47:58 +00:00
|
|
|
if (stacks[i].children.length > 1) {
|
|
|
|
stacks[i].addEventListener('click', swap);
|
|
|
|
stacks[i].style.cursor = 'pointer';
|
|
|
|
}
|
2024-10-16 15:43:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}, timing);
|
2024-10-16 17:18:08 +00:00
|
|
|
|
|
|
|
setTimeout(() => {
|
2024-10-17 14:47:58 +00:00
|
|
|
// this.prepend(thisTarget);
|
2024-10-16 17:18:08 +00:00
|
|
|
thisTarget.style = '';
|
|
|
|
}, 2*timing);
|
2024-10-16 15:43:00 +00:00
|
|
|
}
|