Intersection Observer
![[JS] 스크롤 애니메이션 구현 (Intersection Observer)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FHFYt3%2FbtrsUc6NOYz%2FEuh4pUuUBZ9RgsX24MvTPK%2Fimg.gif)
[JS] 스크롤 애니메이션 구현 (Intersection Observer)
Intersection Observer API로 스크롤 애니메이션을 쉽게 구현할 수 있습니다. Intersection Observer API const options = { root: null, rootMargin: "0px", threshold: 1.0, }; const observer = new IntersectionObserver((entries) => { // 관찰 중인 배열 형식의 객체 리스트 entries.forEach((entry) => { ... }); }, options); // target과 root가 교차되어 화면에 보이게 되었을 때 호출되는 함수 const target = document.querySelector('div'); observer.observe(target); // 새로..