first / index.html
ishaqsaviani's picture
Add 2 files
1230357 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated Button with Ripple Effect</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
.ripple {
position: relative;
overflow: hidden;
}
.ripple-effect {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.7);
transform: scale(0);
animation: ripple 600ms linear;
pointer-events: none;
}
@keyframes ripple {
to {
transform: scale(4);
opacity: 0;
}
}
.btn-glow:hover {
box-shadow: 0 0 15px rgba(99, 102, 241, 0.7);
}
.btn-transform:hover {
transform: translateY(-2px);
}
</style>
</head>
<body class="min-h-screen bg-gradient-to-br from-indigo-50 to-purple-100 flex items-center justify-center p-4">
<div class="text-center">
<h1 class="text-4xl font-bold text-indigo-900 mb-8">Interactive Button Showcase</h1>
<div class="space-y-8">
<!-- Primary Animated Button -->
<div>
<h2 class="text-xl font-semibold text-indigo-800 mb-4">Primary Button</h2>
<button id="primaryBtn" class="ripple btn-glow btn-transform px-8 py-3 bg-indigo-600 text-white font-medium rounded-lg shadow-md hover:bg-indigo-700 transition-all duration-300 ease-in-out">
Click Me
</button>
</div>
<!-- Outline Button -->
<div>
<h2 class="text-xl font-semibold text-indigo-800 mb-4">Outline Button</h2>
<button id="outlineBtn" class="ripple px-8 py-3 border-2 border-indigo-600 text-indigo-600 font-medium rounded-lg hover:bg-indigo-50 transition-all duration-200 ease-in-out">
Hover Effect
</button>
</div>
<!-- Gradient Button -->
<div>
<h2 class="text-xl font-semibold text-indigo-800 mb-4">Gradient Button</h2>
<button id="gradientBtn" class="ripple px-8 py-3 bg-gradient-to-r from-purple-500 to-indigo-600 text-white font-medium rounded-lg hover:shadow-lg transition-all duration-300 ease-in-out">
Cool Gradient
</button>
</div>
</div>
</div>
<script>
// Function to create ripple effect
function createRipple(event) {
const button = event.currentTarget;
const circle = document.createElement("span");
const diameter = Math.max(button.clientWidth, button.clientHeight);
const radius = diameter / 2;
circle.style.width = circle.style.height = `${diameter}px`;
circle.style.left = `${event.clientX - button.getBoundingClientRect().left - radius}px`;
circle.style.top = `${event.clientY - button.getBoundingClientRect().top - radius}px`;
circle.classList.add("ripple-effect");
const ripple = button.getElementsByClassName("ripple-effect")[0];
if (ripple) {
ripple.remove();
}
button.appendChild(circle);
// Remove the ripple element after animation completes
setTimeout(() => {
circle.remove();
}, 600);
}
// Add click event listeners to all buttons
document.querySelectorAll('.ripple').forEach(button => {
button.addEventListener('click', createRipple);
// Add click feedback
button.addEventListener('mousedown', () => {
button.classList.add('scale-95');
});
button.addEventListener('mouseup', () => {
button.classList.remove('scale-95');
});
button.addEventListener('mouseleave', () => {
button.classList.remove('scale-95');
});
});
// Add special functionality to primary button
document.getElementById('primaryBtn').addEventListener('click', () => {
setTimeout(() => {
alert('Button clicked! Great job!');
}, 300);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ishaqsaviani/first" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>