Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 108309 of Window.scrollMaxY

  • Revision slug: DOM/window.scrollMaxY
  • Revision title: window.scrollMaxY
  • Revision id: 108309
  • Created:
  • Creator: shelbymoore3
  • Is current revision? No
  • Comment window.innerHeight + window.scrollMaxY != total document height; 43 words added, 1 words removed

Revision Content

 

{{ DomRef() }}

Summary

Returns the maximum number of pixels that the document can be scrolled vertically.

Syntax

ypix = window.scrollMaxY

Parameters

  • ypix is the number of pixels.

Example

// Scroll to the bottom of the page
 var maxY = window.scrollMaxY;
 window.scrollTo(0,maxY);

Notes

Do not use this property to get the total document height, which is not equivalent to window.innerHeight + window.scrollMaxY, because window.innerHeight includes the width of any visible horizontal scrollbar, thus the result would exceed the total document height by the width of any visible horizontal scrollbar. Instead use document.body.scrollHeight.

See also window.scrollMaxX and window.scrollTo.

Specification

DOM Level 0. Not part of specification.

{{ languages( { "ja": "ja/DOM/window.scrollMaxY" } ) }}

Revision Source

<p> </p>
<p>{{ DomRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>Returns the maximum number of pixels that the document can be scrolled vertically.</p>
<h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval"><em>ypix</em> = window.scrollMaxY
</pre>
<h3 id="Parameters" name="Parameters">Parameters</h3>
<ul> <li><code>ypix</code> is the number of pixels.</li>
</ul>
<h3 id="Example" name="Example">Example</h3>
<pre>// Scroll to the bottom of the page
 var maxY = window.scrollMaxY;
 window.scrollTo(0,maxY);
</pre>
<h3 id="Notes" name="Notes">Notes</h3>
<p>Do not use this property to get the total document height, which is not equivalent to <a href="/en/DOM/window.innerHeight" style="text-decoration: none; color: rgb(4, 137, 183) !important; cursor: default; " title="en/DOM/window.innerHeight">window.innerHeight</a> + window.scrollMaxY, because <a href="/en/DOM/window.innerHeight" style="text-decoration: none; color: rgb(4, 137, 183) !important; cursor: default; " title="en/DOM/window.innerHeight">window.innerHeight</a> includes the width of any visible horizontal scrollbar, thus the result would exceed the total document height by the width of any visible horizontal scrollbar. Instead use document.body.<a href="/en/DOM/element.scrollHeight" style="text-decoration: none; color: rgb(4, 137, 183) !important; cursor: default; " title="en/DOM/element.scrollHeight">scrollHeight</a>.</p>
<p>See also <a href="/en/DOM/window.scrollMaxX" title="en/DOM/window.scrollMaxX">window.scrollMaxX</a> and <a href="/en/DOM/window.scrollTo" title="en/DOM/window.scrollTo">window.scrollTo</a>.</p>
<h3 id="Specification" name="Specification">Specification</h3>
<p>DOM Level 0. Not part of specification.</p>

<p>{{ languages( { "ja": "ja/DOM/window.scrollMaxY" } ) }}</p>
Revert to this revision