Spaces:
Running
Running
File size: 1,865 Bytes
f116a1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
// Toast notification function
function showToast(message, type = 'info') {
const toast = document.createElement('div');
toast.className = `fixed bottom-5 right-5 px-6 py-3 rounded-lg shadow-lg text-white animate__animated animate__fadeInUp animate__faster ${
type === 'success' ? 'bg-green-500' :
type === 'error' ? 'bg-red-500' :
'bg-blue-500'
}`;
toast.innerHTML = `
<div class="flex items-center gap-2">
<i class="fas ${
type === 'success' ? 'fa-check-circle' :
type === 'error' ? 'fa-exclamation-circle' :
'fa-info-circle'
}"></i>
<span>${message}</span>
</div>
`;
document.body.appendChild(toast);
setTimeout(() => {
toast.classList.add('animate__fadeOutDown');
setTimeout(() => toast.remove(), 500);
}, 3000);
}
// Add ripple effect to buttons
document.addEventListener('DOMContentLoaded', () => {
const buttons = document.querySelectorAll('button');
buttons.forEach(button => {
button.addEventListener('click', function(e) {
const x = e.clientX - e.target.getBoundingClientRect().left;
const y = e.clientY - e.target.getBoundingClientRect().top;
const ripple = document.createElement('span');
ripple.className = 'ripple';
ripple.style.left = `${x}px`;
ripple.style.top = `${y}px`;
this.appendChild(ripple);
setTimeout(() => ripple.remove(), 1000);
});
});
});
// Add ripple effect styles
const style = document.createElement('style');
style.innerHTML = `
.ripple {
position: absolute;
background: rgba(255, 255, 255, 0.4);
border-radius: 50%;
transform: scale(0);
animation: ripple 600ms linear;
pointer-events: none;
}
@keyframes ripple {
to {
transform: scale(4);
opacity: 0;
}
}
`;
document.head.appendChild(style); |