Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #14 from itsPG/use-scrollHeight
Browse files Browse the repository at this point in the history
Change `offsetHeight` to `scrollHeight` to fix fixed/absolute positioning issues.
  • Loading branch information
Chris Ferdinandi committed Jan 5, 2014
2 parents 2b1f96a + abd69e4 commit 0a522c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion smooth-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
// Stop animation when you reach the anchor OR the bottom of the page
stopAnimation = function () {
var travelled = window.pageYOffset;
if ( (travelled >= (endLocation(anchor) - increments)) || ((window.innerHeight + travelled) >= document.body.offsetHeight) ) {
if ( (travelled >= (endLocation(anchor) - increments)) || ((window.innerHeight + travelled) >= document.body.scrollHeight) ) {
clearInterval(runAnimation);
updateURL(url, anchor);
}
Expand Down

0 comments on commit 0a522c4

Please sign in to comment.