Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong><a href="https://stackoverflow.com/questions/2817042/determining-when-scrolled-to-bottom-of-a-page-with-javascript">How to tell when you're at the bottom of a page</a></strong>: </p> <pre><code>if ( document.documentElement.clientHeight + $(document).scrollTop() &gt;= document.body.offsetHeight ) { // Display alert or whatever you want to do when you're // at the bottom of the page. alert("You're at the bottom of the page."); } </code></pre> <p>Of course you want to fire the above whenever the user scrolls:</p> <pre><code>$(window).scroll(function() { if ( document.documentElement.clientHeight + $(document).scrollTop() &gt;= document.body.offsetHeight ) { // Display alert or whatever you want to do when you're // at the bottom of the page. alert("You're at the bottom of the page."); } }); </code></pre> <p><strong><a href="http://jsfiddle.net/Lrjkq/" rel="nofollow noreferrer">Here is a jsFiddle example</a></strong> that fades in a "You're Done! Scroll to Top of Page" link when the user has scrolled to the bottom of the page.</p> <p><strong>References:</strong> </p> <ul> <li><strong><a href="http://api.jquery.com/scroll/" rel="nofollow noreferrer"><code>.scroll()</code></a></strong> </li> <li><strong><a href="http://api.jquery.com/scrollTop/" rel="nofollow noreferrer"><code>.scrollTop()</code></a></strong> </li> <li><strong><a href="https://developer.mozilla.org/en/DOM/element.offsetHeight" rel="nofollow noreferrer"><code>offsetHeight</code></a></strong> </li> <li><strong><a href="https://developer.mozilla.org/en/DOM/element.clientHeight" rel="nofollow noreferrer"><code>clientHeight</code></a></strong></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload