Hover Effects Nav
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hover Effects Nav</title> | |
</head> | |
<body> | |
<ul> | |
<li><a href="#">Home</a></li> | |
<li><a href="#">About</a></li> | |
<li><a href="#">Portfolio</a></li> | |
<li><a href="#">Team</a></li> | |
<li><a href="#">Contact Us</a></li> | |
<div class="cursor"></div> | |
</ul> | |
<script type="text/javascript"> | |
const cursor = document.querySelector('.cursor'); | |
document.addEventListener('mousemove', (e) =>{ | |
cursor.style.left = e.pageX + 'px'; | |
cursor.style.top = e.pageY + 'px'; | |
}) | |
</script> | |
</body> | |
</html> | |
<style type="text/css"> | |
body{ | |
font-family: arial; | |
} | |
*{ | |
margin: 0px; | |
padding: 0px; | |
box-sizing: border-box; | |
font-family: arial; | |
} | |
body{ | |
background: #000; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
min-height: 100vh; | |
} | |
ul{ | |
position: relative; | |
/*display: flex;*/ | |
flex-direction: column: | |
} | |
ul li{ | |
list-style: none; | |
} | |
ul li a{ | |
position: relative; | |
display: inline-block; | |
margin: 10px 0px; | |
font-size: 4em; | |
text-decoration: none; | |
color: #fff; | |
transition: 0.2s; | |
} | |
.cursor{ | |
position: fixed; | |
width: 20px; | |
height: 20px; | |
border-radius: 50%; | |
background: #fff; | |
transition: 0.1s; | |
transform: translate(-50%,-50%); | |
pointer-events: none; | |
mix-blend-mode: difference; | |
} | |
ul li:hover ~ .cursor{ | |
transform: scale(6); | |
} | |
</style> |
Comments
Post a Comment