Illie
mouseEffect02 - 따라다니기 본문
JS구성
1. 마우스 오버 했을 때 클래스 active 추가 & 나갔을 때 클래스 active 삭제
document.querySelectorAll(".mouse__wrap p span").forEach(span => {
span.addEventListener("mouseenter", () => {
cursor.classList.add("active");
follower.classList.add("active");
})
span.addEventListener("mouseleave", () => {
cursor.classList.remove("active");
follower.classList.remove("active");
})
})
2. 내친김에 위에 인포메이션(제목, 목차 등)에도 적용해주자!
document.querySelector(".info").addEventListener("mouseover", (info) => {
cursor.classList.add("show")
follower.classList.add("show");
})
document.querySelector(".info").addEventListener("mouseout", (info) => {
cursor.classList.remove("show");
follower.classList.remove("show");
})
https://sungilryuu.github.io/webs_class/javascript/effect/mouseEffect02.html
'JAVASCRIPT > 자바스크립트' 카테고리의 다른 글
mouseEffect03 - 조명효과 (0) | 2022.03.07 |
---|---|
오답노트 6차 (0) | 2022.03.07 |
mouseEffect01 - 따라다니기 (0) | 2022.03.04 |
JS. 즉시실행함수, 파라미터 함수 (0) | 2022.03.04 |
JS. 아규먼트 함수 (0) | 2022.03.04 |
Comments