diff options
author | Peter Bengtsson <mail@peterbe.com> | 2021-06-17 13:35:36 -0400 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2021-06-18 01:41:27 +0800 |
commit | d490e42ffe823173477b841ec397105bd06cb336 (patch) | |
tree | 0c0a208e8e7cffa0f37cbaa2b463f4448ba9edc9 /files/zh-cn/web/api/range | |
parent | 64471936f0c8ee43b7a35c4a020c6435e64dfcaf (diff) | |
download | translated-content-d490e42ffe823173477b841ec397105bd06cb336.tar.gz translated-content-d490e42ffe823173477b841ec397105bd06cb336.tar.bz2 translated-content-d490e42ffe823173477b841ec397105bd06cb336.zip |
rid of $samples iframes
Diffstat (limited to 'files/zh-cn/web/api/range')
-rw-r--r-- | files/zh-cn/web/api/range/getboundingclientrect/index.html | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/files/zh-cn/web/api/range/getboundingclientrect/index.html b/files/zh-cn/web/api/range/getboundingclientrect/index.html index 4c10f536b0..d49eb8c65c 100644 --- a/files/zh-cn/web/api/range/getboundingclientrect/index.html +++ b/files/zh-cn/web/api/range/getboundingclientrect/index.html @@ -22,16 +22,16 @@ translation_of: Web/API/Range/getBoundingClientRect <pre class="syntaxbox notranslate"><var>boundingRect</var> = <var>range</var>.getBoundingClientRect() </pre> -<h2 id="示例">示例</h2> +<h2 id="Example">示例</h2> <h3 id="HTML">HTML</h3> -<pre class="brush: html notranslate"><div id="highlight"></div> +<pre class="brush: html "><div id="highlight"></div> <p>This example positions a "highlight" rectangle behind the contents of a range. The range's content <b>starts here</b> and continues on until it <b>ends here</b>. The bounding client rectangle contains everything selected in the range.</p></pre> <h3 id="CSS">CSS</h3> -<pre class="brush: css notranslate">#highlight { +<pre class="brush: css">#highlight { background: yellow; position: absolute; z-index: -1; @@ -43,7 +43,7 @@ p { <h3 id="JavaScript">JavaScript</h3> -<pre class="brush: js notranslate">const range = document.createRange(); +<pre class="brush: js">const range = document.createRange(); range.setStartBefore(document.getElementsByTagName('b').item(0), 0); range.setEndAfter(document.getElementsByTagName('b').item(1), 0); @@ -56,30 +56,15 @@ highlight.style.height = `${clientRect.height}px`;</pre> <h3 id="结果">结果</h3> -<p><iframe class="live-sample-frame sample-code-frame" frameborder="0" id="frame_Example" src="https://mdn.mozillademos.org/en-US/docs/Web/API/Range/getBoundingClientRect$samples/Example?revision=1549349"></iframe></p> +<p>{{EmbedLiveSample("Example")}}</p> <h2 id="规范">规范</h2> -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">规范</th> - <th scope="col">状态</th> - <th scope="col">备注</th> - </tr> - <tr> - <td>{{SpecName('CSSOM View', '#dom-range-getboundingclientrect', 'Range.getBoundingClientRect()')}}</td> - <td>{{Spec2('CSSOM View')}}</td> - <td>Initial specification.</td> - </tr> - </tbody> -</table> +{{Specifications}} <h2 id="浏览器兼容性">浏览器兼容性</h2> - - -<p>{{Compat("api.Range.getBoundingClientRect")}}</p> +<p>{{Compat}}</p> <h2 id="参见">参见</h2> |