-1
I’m making a "delete account" button where there’s an animation of blood drops falling. But I would like to make the animation start only when someone hovers over the top (Hover).
Could someone help me?
Thank you!
HTML
<!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>Document</title>
<link rel="stylesheet" href="./teste.css">
</head>
<body>
<button type="submit" id="delete" name="delete">Deletar conta</button>
<div class="blood">
<div><img src="https://i.ibb.co/0DtRqY9/gota-De-Sangue.png" alt="gota-De-Sangue" border="0"></div>
<div><img src="https://i.ibb.co/0DtRqY9/gota-De-Sangue.png" alt="gota-De-Sangue" border="0"></div>
<div><img src="https://i.ibb.co/0DtRqY9/gota-De-Sangue.png" alt="gota-De-Sangue" border="0"></div>
<div><img src="https://i.ibb.co/0DtRqY9/gota-De-Sangue.png" alt="gota-De-Sangue" border="0"></div>
</div>
</body>
</html>
CSS
#delete {
width: 235px;
height: 40px;
background-color: #ba1900;
font-size: 18px;
font-weight: bold;
border: none;
color: #fff;
transition: all 0.3s;
cursor: pointer;
}
#delete:hover {
background-color: #ff0000;
transition: all 0.3s;
}
.blood{
position: absolute;
top: 80px;
left: 0;
width: 100%;
height: 100%;
}
.blood div{
position: absolute;
display: block;
}
.blood div:nth-child(1){
left: 0%;
animation: animate 10s linear infinite;
animation-delay: -0.5s;
}
.blood div:nth-child(2){
left: 13%;
animation: animate 10s linear infinite;
animation-delay: -2.5s;
}
.blood div:nth-child(3){
left: 5%;
animation: animate 10s linear infinite;
animation-delay: -4.5s;
}
.blood div:nth-child(4){
left: 11%;
animation: animate 10s linear infinite;
animation-delay: -6.5s;
}
@keyframes animate{
0%{
top: -10%;
}
100%{
top: 10%
}
}
Thank you so much!!! .
– Marcelo Gamon