aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/intersectionobserver/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/api/intersectionobserver/index.md')
-rw-r--r--files/ko/web/api/intersectionobserver/index.md118
1 files changed, 47 insertions, 71 deletions
diff --git a/files/ko/web/api/intersectionobserver/index.md b/files/ko/web/api/intersectionobserver/index.md
index 047b13abdd..bcfe2e9a3c 100644
--- a/files/ko/web/api/intersectionobserver/index.md
+++ b/files/ko/web/api/intersectionobserver/index.md
@@ -3,93 +3,69 @@ title: IntersectionObserver
slug: Web/API/IntersectionObserver
tags:
- API
- - Experimental
- Interface
- Intersection Observer API
- IntersectionObserver
- - NeedsTranslation
- Reference
- - TopicStub
- - observers
+browser-compat: api.IntersectionObserver
translation_of: Web/API/IntersectionObserver
---
-<div>{{APIRef("Intersection Observer API")}}</div>
+{{APIRef("Intersection Observer API")}}
-<p><a href="/en-US/docs/Web/API/Intersection_Observer_API">Intersection Observer API</a> 의 <code><strong>IntersectionObserver</strong></code> 인터페이스는 대상 요소와 그 상위 요소 혹은 최상위 도큐먼트인 <span class="seoSummary">{{Glossary('viewport')}}</span>와의 교차 영역에 대한 변화를 비동기적으로 감지할 수 있도록 도와줍니다.</p>
+[Intersection Observer API](/ko/docs/Web/API/Intersection_Observer_API)의 **`IntersectionObserver`** 인터페이스는 대상 요소와 상위 요소, 또는 대상 요소와 최상위 문서의 {{Glossary("viewport", "뷰포트")}}가 서로 교차하는 영역이 달라지는 경우 이를 비동기적으로 감지할 수 있는 수단을 제공합니다.
-<p> <code>IntersectionObserver</code> 가 생성되면, 루트 내에서 설정된 비율 만큼의 가시성을 계속 감시하도록 설정됩니다. 한번 생성되고 나면, 설정 값은 변경될 수 없으므로, 생성된 감시자 객체는 가시성 정도의 변화를 감시하는 데에만 쓰일 수 있습니다. 하지만 동일한 감시자 객체로 여러 대상 요소를 감시할 수 있습니다.</p>
+`IntersectionObserver`가 생성되면 루트 내에서 설정된 가시성 비율이 자신의 주시 대상 중에서 나타나는지 감지하기 시작합니다. 한 번 생성한 이후에는 설정을 변경할 수 없으므로, 이미 생성된 감지기 객체는 지정했던 가시성 비율의 감지에만 사용할 수 있습니다. 그래도 하나의 감지기가 다수의 대상을 한꺼번에 주시할 수 있습니다.
-<h2 id="Constructor">Constructor</h2>
+## 생성자
-<dl>
- <dt>{{domxref("IntersectionObserver.IntersectionObserver()")}}</dt>
- <dd><code>IntersectionObserver</code> 객체를 생성합니다. 해당 객체는 대상 요소의 가시성이 하나 이상의 설정된 정도 값을 넘을 경우 주어진 콜백 함수를 실행합니다.</dd>
-</dl>
+- {{domxref("IntersectionObserver.IntersectionObserver()")}}
+ - : `IntersectionObserver` 객체를 생성합니다. `IntersectionObserver` 객체는 대상 요소의 가시성 비율이 설정한 역치 값을 넘어가는 것을 감지하면 지정한 콜백을 호출합니다.
-<h2 id="Properties">Properties</h2>
+## 속성
-<dl>
- <dt>{{domxref("IntersectionObserver.root")}} {{readonlyinline}}</dt>
- <dd>대상 요소 ({{domxref("element")}}) 를 감시할 상위 요소. 값을 넣지 않거나 <code>null</code> 일 경우, 최상위 문서의 뷰포트가 사용된다.</dd>
- <dt>{{domxref("IntersectionObserver.rootMargin")}} {{readonlyinline}}</dt>
- <dd>교차 정도를 계산할 때 루트의 {{Glossary('bounding box')}} 에 적용되는 offset 사각형으로, 루트의 범위를 효과적으로 늘리거나 줄입니다. 이 특성이 반환한 값은, 생성자를 호출 할 때 내부 요구 사항에 맞게 변경 될 수 있으므로 지정된 값과 같지 않을 수 있습니다. 각 offset 은 픽셀(<code>px</code>) 혹은 퍼센트(<code>%</code>)로 표기될 수 있습니다. 기본 값은 "0px 0px 0px 0px" 입니다.</dd>
- <dt>{{domxref("IntersectionObserver.thresholds")}} {{readonlyinline}}</dt>
- <dd>임계값 목록. 숫자의 오름차순으로 정렬되며, 각 임계 값은 감시하는 대상의 경계 상자 영역과의 교차 비율입니다. 대상에 대한 알림은 해당 대상에 대한 임계 값이 초과 될 때 생성됩니다. 생성자에 값이 전달되지 않을 경우 0이 사용됩니다.</dd>
-</dl>
+- {{domxref("IntersectionObserver.root")}} {{readonlyinline}}
+ - : 교차 영역 계산에 사용하는 바운딩 박스의 기준이 되는 {{domxref("Element")}} 또는 {{domxref("Document")}}입니다. `root` 설정을 생성자에 제공하지 않았거나, `root`의 값이 `null`인 경우 최상위 문서의 뷰포트를 사용합니다.
+- {{domxref("IntersectionObserver.rootMargin")}} {{readonlyinline}}
+ - : 교차 영역을 계산할 때 루트의 {{glossary("bounding box", "바운딩 박스")}}에 적용할 오프셋입니다. 즉, 필요에 따라 계산 용도로 루트 영역을 늘리거나 줄일 수 있습니다. 생성자 설정에 지정한 값은 생성자 내에서 내부 조건에 맞도록 조정 과정을 거치므로, 이 속성의 반환 값이 설정 값과 다를 수도 있습니다. 각각의 오프셋에는 픽셀(`px`)과 퍼센트(`%`)를 사용할 수 있으며, 기본 값은 `0px 0px 0px 0px`입니다.
+- {{domxref("IntersectionObserver.thresholds")}} {{readonlyinline}}
+ - : 오름차순으로 정렬된 역치 리스트입니다. 각각의 역치는 대상의 바운딩 박스 영역과 교차 영역 사이의 비율에 대한 역치입니다. 대상에 대한 교차 알림(콜백 호출)은 이 역치 값 중 하나라도 넘어갈 때 발생합니다. 아무 값도 생성자에 지정하지 않은 경우의 기본 값은 0입니다.
-<h2 id="Methods">Methods</h2>
+## 메서드
-<dl>
- <dt>{{domxref("IntersectionObserver.disconnect()")}}</dt>
- <dd><code>IntersectionObserver</code> 가 어떤 대상이라도 감시하는 것을 중지합니다.</dd>
- <dt>{{domxref("IntersectionObserver.observe()")}}</dt>
- <dd>대상 요소에 대한 감시를 시작합니다.</dd>
- <dt>{{domxref("IntersectionObserver.takeRecords()")}}</dt>
- <dd>모든 감시되는 대상의 배열 ({{domxref("IntersectionObserverEntry")}}) 을 리턴합니다.</dd>
- <dt>{{domxref("IntersectionObserver.unobserve()")}}</dt>
- <dd>특정 대상 요소를 감시하는 것을 중지합니다.</dd>
-</dl>
+- {{domxref("IntersectionObserver.disconnect()")}}
+ - : 모든 대상의 주시를 해제합니다.
+- {{domxref("IntersectionObserver.observe()")}}
+ - : 주어진 대상 요소를 주시합니다.
+- {{domxref("IntersectionObserver.takeRecords()")}}
+ - : 모든 주시 대상에 대한 {{domxref("IntersectionObserverEntry")}} 배열을 반환합니다.
+- {{domxref("IntersectionObserver.unobserve()")}}
+ - : 특정 대상 요소에 대한 주시를 해제합니다.
-<h2 id="Examples">Examples</h2>
+## 예제
-<pre class="brush: js">var intersectionObserver = new IntersectionObserver(function(entries) {
- // If intersectionRatio is 0, the target is out of view
- // and we do not need to do anything.
- if (entries[0].intersectionRatio &lt;= 0) return;
+```js
+var intersectionObserver = new IntersectionObserver(function(entries) {
+ // intersectionRatio가 0이라는 것은 대상을 볼 수 없다는 것이므로
+ // 아무것도 하지 않음
+ if (entries[0].intersectionRatio <= 0) return;
loadItems(10);
- console.log('Loaded new items');
+ console.log('새 항목 불러옴');
});
-// start observing
-intersectionObserver.observe(document.querySelector('.scrollerFooter'));</pre>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName("IntersectionObserver", "#intersection-observer-interface", "IntersectionObserver")}}</td>
- <td>{{Spec2('IntersectionObserver')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-<p>{{Compat("api.IntersectionObserver")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li>{{domxref('MutationObserver')}}</li>
- <li>{{domxref('PerformanceObserver')}}</li>
- <li>{{domxref('ResizeObserver')}}</li>
-</ul>
+// 주시 시작
+intersectionObserver.observe(document.querySelector('.scrollerFooter'));
+```
+
+## 명세
+
+{{Specifications}}
+
+## 브라우저 호환성
+
+{{Compat}}
+
+## 같이 보기
+
+- {{domxref('MutationObserver')}}
+- {{domxref('PerformanceObserver')}}
+- {{domxref('ResizeObserver')}}