<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
}
.heart {
position: absolute;
margin: auto;
top: 90%;
left: 90%;
background-color: #ff1616;
height: 10px;
width: 10px;
transform: rotate(-135deg);
cursor:pointer;
box-shadow: rgba(0, 0, 0, 0.56) 0px 22px 70px 4px;
}
.heart:after {
background-color: #ff1616;
content: "";
border-radius: 50%;
position: absolute;
width: 10px;
height: 10px;
top: 0px;
left: 4px;
}
.heart:before {
background-color: #ff1616;
content: "";
border-radius: 50%;
position: absolute;
width: 10px;
height: 10px;
top: 4px;
left: 0px;
}
</style>
</head>
<body>
<div class="heart"><br><br>
</div>
<script>
const circle = document.querySelector(".heart");
document.addEventListener("mousemove", (e) => {
const mouseX = e.clientX;
const mouseY = e.clientY;
circle.style.left = mouseX + 'px';
circle.style.top = mouseY + 'px';
});
</script>
</body>
</html>
0 Comments