| // Ripple effect for Button 9 | |
| document.querySelectorAll('.btn-ripple').forEach(button => { | |
| button.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| const x = e.clientX - e.target.getBoundingClientRect().left; | |
| const y = e.clientY - e.target.getBoundingClientRect().top; | |
| const ripple = document.createElement('span'); | |
| ripple.className = 'ripple-effect'; | |
| ripple.style.left = `${x}px`; | |
| ripple.style.top = `${y}px`; | |
| this.appendChild(ripple); | |
| setTimeout(() => { | |
| ripple.remove(); | |
| }, 1000); | |
| }); | |
| }); | |
| // Style for ripple effect | |
| const style = document.createElement('style'); | |
| style.textContent = ` | |
| .ripple-effect { | |
| position: absolute; | |
| border-radius: 50%; | |
| background-color: rgba(255, 255, 255, 0.7); | |
| transform: scale(0); | |
| animation: ripple 0.6s linear; | |
| pointer-events: none; | |
| width: 20px; | |
| height: 20px; | |
| } | |
| @keyframes ripple { | |
| to { | |
| transform: scale(4); | |
| opacity: 0; | |
| } | |
| } | |
| `; | |
| document.head.appendChild(style); |