IntersectionObserver.unobserve()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2019년 3월.
IntersectionObserver의 unobserve() 메서드는 특정 요소에 대한 가시성 변화 주시를 중단합니다.
구문
js
IntersectionObserver.unobserve(target);
매개변수
반환 값
undefined.
예제
아래 코드는 감지기를 생성한 후 요소를 주시하고, 다시 주시를 해제하는 예제입니다.
js
var observer = new IntersectionObserver(callback);
observer.observe(document.getElementById("elementToObserve"));
/* ... */
observer.unobserve(document.getElementById("elementToObserve"));
명세
| Specification |
|---|
| Intersection Observer> # dom-intersectionobserver-unobserve> |
브라우저 호환성
Loading…