일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 해피CGI
- 솔루션
- #솔루션
- 해피씨지아이
- 사이트제작
- 홈페이지
- #이미지
- #홈페이지제작
- #jQuery
- #happycgi
- 홈페이지제작
- #cgimall
- #CSS
- javascript
- happycgi
- CSS
- #웹솔루션
- #쇼핑몰
- 게시판
- #업종별
- CGIMALL
- #동영상
- #뉴스
- #해피CGI
- 이미지
- #홈페이지
- 웹솔루션
- #image
- jquery
- php
- Today
- Total
웹솔루션개발 25년 노하우! 해피CGI의 모든것
[해피CGI][cgimall] 마우스 효과가 들어간 네비게이션 커서 이펙트 Navigation Cursor Effect 본문
[해피CGI][cgimall] 마우스 효과가 들어간 네비게이션 커서 이펙트 Navigation Cursor Effect
해피CGI윤실장 2025. 6. 19. 09:13
마우스 효과가 들어간 네비게이션 커서 이펙트입니다.
응용하여 다양하게 활용 가능합니다.
HTML 구조
<div class="nav-wrapper">
<nav>
<a href="#" class="link">
<span>Home</span>
</a>
<a href="#" class="link">
<span>Our Story</span>
</a>
<a href="#" class="link">
<span>Studio</span>
</a>
<a href="#" class="link">
<span>Contact</span>
</a>
<div class="cursor"></div>
</nav>
</div>
CSS 소스
@import url('https://fonts.googleapis.com/css?family=Poppins:300,400,500,750,700,800,900&display=swap');
body {
margin: 0;
padding: 0;
cursor: none;
font-family: 'Poppins', sans-serif;
}
.nav-wrapper {
width: 100%;
height: 100vh;
background: #161616;
}
.nav-wrapper nav {
display: flex;
justify-content: space-around;
width: 100%;
margin: 0 auto;
text-align: center;
position: absolute;
top: 50%;
}
.link {
transition: all 0.3s ease;
}
.link span {
display: inline-block;
font-weight: bold;
letter-spacing: 1px;
color: #fff;
font-size: 36px;
text-transform: uppercase;
pointer-event: none;
transition: transform 0.1s linear;
}
.cursor {
pointer-events: none;
position: fixed;
padding: 0.3rem;
background-color: #fff;
border-radius: 50%;
mix-blend-mode: difference;
transition: transform 0.3s ease;
}
.link:hover ~ .cursor {
transform:translate(-50%, -50%) scale(8);
}
@media screen and (max-width: 1024px) {
.nav-wrapper nav {
flex-direction: column;
}
}
JS 소스
(function () {
const link = document.querySelectorAll('nav > .link');
const cursor = document.querySelector('.cursor');
const animateit = function (e) {
const span = this.querySelector('.link > span');
const { offsetX: x, offsetY: y } = e,
{ offsetWidth: width, offsetHeight: height } = this,
move = 25,
xMove = x / width * (move * 2) - move,
yMove = y / height * (move * 2) - move;
span.style.transform = `translate(${xMove}px, ${yMove}px)`;
if (e.type === 'mouseleave') span.style.transform = '';
};
const editCursor = e => {
const { clientX: x, clientY: y } = e;
cursor.style.left = x + 'px';
cursor.style.top = y + 'px';
};
link.forEach(b => b.addEventListener('mousemove', animateit));
link.forEach(b => b.addEventListener('mouseleave', animateit));
window.addEventListener('mousemove', editCursor);
})();
해당 사이트로 이동해서 전체 소스를 확인하실 수 있습니다.
'웹프로그램밍 자료실 > HTML 자료' 카테고리의 다른 글
[해피CGI][cgimall] Card Carousel -카드 슬라이더 (0) | 2025.06.24 |
---|---|
[해피CGI][cgimall] 마우스 오버 버튼 효과 Minimalist Button Hover Effect (0) | 2025.06.20 |
[해피CGI][cgimall] CSS Gooey Menu (Version 3) (0) | 2025.05.21 |
[해피CGI][cgimall] Pure SVG Loader Animation -SVG 동적 로딩 애니메이션 (0) | 2025.05.20 |
[해피CGI][cgimall] LetterMorph (0) | 2025.05.15 |