blob: eb4b7314322970ed8d1bbed176aa81637d5702ca (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
---
title: IntersectionObserver.unobserve()
slug: Web/API/IntersectionObserver/unobserve
tags:
- API
- Intersection Observer
- IntersectionObserver API
- IntersectioonObserver
- Méthode
- Reference
translation_of: Web/API/IntersectionObserver/unobserve
---
<div>{{APIRef("Intersection Observer API")}}{{SeeCompatTable}}</div>
<p><span class="seoSummary">La méthode <code><strong>unobserve()</strong></code> de l'interface {{domxref("IntersectionObserver")}} indique à l'<code>IntersectionObserver</code> de cesser d'observer l'élément cible spécifié.</span></p>
<h2 id="Syntaxe">Syntaxe</h2>
<pre class="syntaxbox"><em>IntersectionObserver</em>.unobserve(cible);</pre>
<h3 id="Paramètress">Paramètress</h3>
<dl>
<dt><code>cible</code></dt>
<dd>L'{{domxref("Element")}} à cesser d'observer. Si l'élément spécifié n'est pas en cours d'observation, cette méthode ne fait rien et ne jette pas d'erreur.</dd>
</dl>
<h3 id="Valeur_de_retour">Valeur de retour</h3>
<p><code>undefined</code>.</p>
<dl>
</dl>
<h2 id="Exemples">Exemples</h2>
<p>Ce bout de code montre simplement la création d'un observateur, l'ajout d'un élément sous observation puis sa fin d'observation.</p>
<pre class="brush: js">let observer = new IntersectionObserver(fonctionRappel);
observateur.observe(document.getElementById("élémentÀObserver"));
/* ... */
observateur.unobserve(document.getElementById("élémentÀObserver"));</pre>
<h2 id="Spécifications">Spécifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
<th scope="col">Commentaire</th>
</tr>
<tr>
<td>{{SpecName('IntersectionObserver','#dom-intersectionobserver-unobserve','IntersectionObserver.unobserve()')}}</td>
<td>{{Spec2('IntersectionObserver')}}</td>
<td>Définition initiale.</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>
<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
<p>{{Compat("api.IntersectionObserver.unobserve")}}</p>
<h2 id="Voir_aussi">Voir aussi</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Intersection_Observer_API">Intersection Observer API</a></li>
<li>{{domxref("IntersectionObserver.observe()")}}</li>
</ul>
|