aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/scrollmaxx
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/window/scrollmaxx
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/window/scrollmaxx')
-rw-r--r--files/zh-cn/web/api/window/scrollmaxx/index.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/window/scrollmaxx/index.html b/files/zh-cn/web/api/window/scrollmaxx/index.html
new file mode 100644
index 0000000000..c6cebd7d02
--- /dev/null
+++ b/files/zh-cn/web/api/window/scrollmaxx/index.html
@@ -0,0 +1,45 @@
+---
+title: Window.scrollMaxX
+slug: Web/API/Window/scrollMaxX
+tags:
+ - API
+ - DOM
+ - Window
+ - 属性
+ - 接口
+translation_of: Web/API/Window/scrollMaxX
+---
+<div>{{APIRef}} {{Non-standard_header}}</div>
+
+<p><code><strong>Window.scrollMaxX</strong></code> 只读属性,返回有关文档可水平滚动的最大像素数。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><em>xMax</em> = window.scrollMaxX
+</pre>
+
+<ul>
+ <li><code>xMax</code> 是像素数。</li>
+</ul>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush:js">// 滚动到页面的右边缘
+let maxX = window.scrollMaxX;
+
+window.scrollTo(maxX, 0);
+</pre>
+
+<h2 id="提示">提示</h2>
+
+<p>不要用这个属性来获得文档总宽度,文档总宽度不等于<a href="/en-US/docs/DOM/window.innerWidth" title="DOM/window.innerWidth">window.innerWidth</a> + window.scrollMaxX。因为 {{domxref("window.innerWidth")}}包含所有可见的垂直滚动条的宽度,所以结果会超出文档总宽度,多出所有可见的垂直滚动条的宽度。作为替代,可使用{{domxref("element.scrollWidth","document.body.scrollWidth")}}。查看相关:{{domxref("window.scrollMaxY")}}。</p>
+
+<h2 id="规范">规范</h2>
+
+<p id="comment_text_2">不属于任何规范。</p>
+
+<h2 id="浏览器兼容">浏览器兼容</h2>
+
+
+
+<p>{{Compat("api.Window.scrollMaxX")}}</p>