diff options
Diffstat (limited to 'files/zh-cn/conflicting/web/api/documentorshadowroot/elementsfrompoint/index.html')
-rw-r--r-- | files/zh-cn/conflicting/web/api/documentorshadowroot/elementsfrompoint/index.html | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/files/zh-cn/conflicting/web/api/documentorshadowroot/elementsfrompoint/index.html b/files/zh-cn/conflicting/web/api/documentorshadowroot/elementsfrompoint/index.html deleted file mode 100644 index 3b1043f630..0000000000 --- a/files/zh-cn/conflicting/web/api/documentorshadowroot/elementsfrompoint/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Document.elementsFromPoint() -slug: conflicting/Web/API/DocumentOrShadowRoot/elementsFromPoint -translation_of: Web/API/DocumentOrShadowRoot/elementsFromPoint -translation_of_original: Web/API/Document/elementsFromPoint -original_slug: Web/API/Document/elementsFromPoint ---- -<div>{{APIRef("DOM")}}{{SeeCompatTable}}</div> - -<p><code><strong>elementsFromPoint()</strong></code> 方法可以获取到当前视口内指定坐标处,由里到外排列的所有元素。</p> - -<h2 id="语法">语法</h2> - -<pre class="brush: js">var<em> elements</em> = <em>document</em>.elementsFromPoint(<em>x</em>, <em>y</em>);</pre> - -<h3 id="返回值">返回值</h3> - -<p>一个包含多个元素的数组</p> - -<h3 id="参数">参数</h3> - -<dl> - <dt>x</dt> - <dd>当前视口内某一点的横坐标</dd> - <dt>y</dt> - <dd>当前视口内某一点的纵坐标</dd> -</dl> - -<h2 id="Example" name="Example">示例</h2> - -<h3 id="HTML">HTML</h3> - -<pre class="brush: html"><div> - <p>Some text</p> -</div> -<p>Elements at point 30, 20:</p> -<div id="output"></div> -</pre> - -<h3 id="JavaScript">JavaScript</h3> - -<pre class="brush: js;highlight[1]">var output = document.getElementById("output"); -if (document.elementsFromPoint) { - var elements = document.elementsFromPoint(30, 20); - for(var i = 0; i < elements.length; i++) { - output.textContent += elements[i].localName; - if (i < elements.length - 1) { - output.textContent += " < "; - } - } -} else { - output.innerHTML = "<span style=\"color: red;\">" + - "您的浏览器不支持 <code>document.elementsFromPoint()</code>" + - "</span>"; -}</pre> - -<p>{{EmbedLiveSample('Example', '420', '120')}}</p> - -<h2 id="规范">规范</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint')}}</td> - <td>{{Spec2('CSSOM View')}}</td> - <td>Initial definition.</td> - </tr> - </tbody> -</table> - -<h2 id="浏览器兼容性">浏览器兼容性</h2> - -<p>{{CompatibilityTable}}</p> - -<div id="compat-desktop"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td> {{CompatChrome(43.0)}}</td> - <td>{{CompatGeckoDesktop("46.0")}}<sup>[1]</sup></td> - <td>10.0 {{property_prefix("ms")}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatSafari(11)}}</td> - </tr> - </tbody> -</table> -</div> - -<div id="compat-mobile"> -<table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Android Webview</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - <th>Chrome for Android</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{CompatNo}}</td> - <td>{{CompatChrome(43.0)}}</td> - <td>{{CompatGeckoMobile("46.0")}}<sup>[1]</sup></td> - <td>{{CompatUnknown}}</td> - <td>{{CompatUnknown}}</td> - <td>{{CompatSafari(11)}}</td> - <td>{{CompatChrome(43.0)}}</td> - </tr> - </tbody> -</table> -</div> - -<p> </p> |