day 20 completed

pull/109/head
couldntfindabetterusername 4 years ago
parent 845228263e
commit bc58937edc

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>20 button ripple effect</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<button class="ripple">Click me</button>
<script src="script.js"></script>
</body>
</html>

@ -0,0 +1,12 @@
const button = document.querySelector("button");
button.addEventListener("click", (e) => {
const circle = document.createElement("div");
circle.classList.add("circle");
circle.style.left = `${e.clientX - e.target.offsetLeft}px`;
circle.style.top = `${e.clientY - e.target.offsetTop}px`;
console.log(e);
button.appendChild(circle);
setTimeout(() => circle.remove(), 500);
});

@ -0,0 +1,47 @@
* {
margin: 0;
padding: 0;
}
body {
background-color: #010101;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
button {
background-color: #99319b;
color: #fff;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
padding: 15px 30px;
border: unset;
letter-spacing: 2px;
text-transform: uppercase;
position: relative;
overflow: hidden;
}
button:focus {
outline: none;
}
button .circle {
position: absolute;
background-color: rgba(255, 255, 255, 0.75);
border: 2px solid #fff;
width: 100px;
height: 100px;
border-radius: 50%;
transform: translate(-50%, -50%) scale(0);
animation: scale 0.5s linear;
}
@keyframes scale {
to {
transform: translate(-50%, -50%) scale(3);
opacity: 0;
}
}
Loading…
Cancel
Save