mirror of
https://github.com/RetroDECK/RetroDECK-Website.git
synced 2024-11-24 15:45:38 +00:00
fe73cca82a
- Disable eventlistener on 1-image stacks - Remove cursor on 1-image stacks
26 lines
782 B
JavaScript
26 lines
782 B
JavaScript
let timing = 250;
|
|
let stacks = document.getElementsByClassName('stack');
|
|
|
|
for (let i = 0; i < stacks.length; i++) {
|
|
[...stacks[i].children].reverse().forEach(j => stacks[i].append(j));
|
|
if (stacks[i].children.length > 1) {
|
|
stacks[i].addEventListener('click', swap);
|
|
stacks[i].style.cursor = 'pointer';
|
|
}
|
|
}
|
|
|
|
function swap(e) {
|
|
let thisTarget = e.target
|
|
if (!thisTarget.classList.contains('screenshot')) return;
|
|
thisTarget.style.animation = `fade-out ${timing}ms ease-in forwards`;
|
|
|
|
setTimeout(() => {
|
|
thisTarget.style.animation = `fade-in ${timing}ms ease-out forwards`;
|
|
this.prepend(thisTarget);
|
|
}, timing);
|
|
|
|
setTimeout(() => {
|
|
// this.prepend(thisTarget);
|
|
thisTarget.style = '';
|
|
}, 2*timing);
|
|
} |