mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-10 01:52:19 +00:00
23 lines
737 B
JavaScript
23 lines
737 B
JavaScript
|
// disables kudos button after click
|
||
|
|
||
|
document.addEventListener('DOMContentLoaded', () => {
|
||
|
const kudosButton = document.querySelector('.kudos-button');
|
||
|
const kudosText = document.querySelector('.kudos-text');
|
||
|
const emojiSpan = kudosButton.querySelector('.emoji');
|
||
|
|
||
|
kudosButton.addEventListener('click', () => {
|
||
|
kudosButton.disabled = true;
|
||
|
kudosButton.classList.add('clicked');
|
||
|
|
||
|
kudosText.textContent = 'Thanks!';
|
||
|
kudosText.classList.add('thanks');
|
||
|
|
||
|
// Rotate the emoji
|
||
|
emojiSpan.style.transform = 'rotate(360deg)';
|
||
|
|
||
|
// Change the emoji after rotation
|
||
|
setTimeout(() => {
|
||
|
emojiSpan.textContent = '🎉';
|
||
|
}, 150); // Half of the transition time for a smooth mid-rotation change
|
||
|
});
|
||
|
});
|