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

Iksi patch 1 #255

Merged
merged 2 commits into from Apr 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 13 additions & 4 deletions dist/js/smooth-scroll.js
@@ -1,5 +1,5 @@
/*!
* smooth-scroll v9.1.3: Animate scrolling to anchor links
* smooth-scroll v9.1.4: Animate scrolling to anchor links
* (c) 2016 Chris Ferdinandi
* MIT License
* http://github.com/cferdinandi/smooth-scroll
Expand Down Expand Up @@ -289,9 +289,18 @@
anchor = anchor.offsetParent;
} while (anchor);
}
location = location - headerHeight - offset;
return location >= 0 ? location : 0;
location = Math.max(location - headerHeight - offset, 0);
return Math.min(location, getDocumentHeight() - getViewportHeight());
};

/**
* Determine the viewport's height
* @private
* @returns {Number}
*/
var getViewportHeight = function() {
return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
};

/**
* Determine the document's height
Expand Down Expand Up @@ -502,4 +511,4 @@

return smoothScroll;

});
});
4 changes: 2 additions & 2 deletions dist/js/smooth-scroll.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions docs/dist/js/smooth-scroll.js
@@ -1,5 +1,5 @@
/*!
* smooth-scroll v9.1.2: Animate scrolling to anchor links
* smooth-scroll v9.1.4: Animate scrolling to anchor links
* (c) 2016 Chris Ferdinandi
* MIT License
* http://github.com/cferdinandi/smooth-scroll
Expand Down Expand Up @@ -122,7 +122,7 @@
}

// Get closest match
for ( ; elem && elem !== document; elem = elem.parentNode ) {
for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) {

// If selector is a class
if ( firstChar === '.' ) {
Expand Down Expand Up @@ -289,9 +289,18 @@
anchor = anchor.offsetParent;
} while (anchor);
}
location = location - headerHeight - offset;
return location >= 0 ? location : 0;
location = Math.max(location - headerHeight - offset, 0);
return Math.min(location, getDocumentHeight() - getViewportHeight());
};

/**
* Determine the viewport's height
* @private
* @returns {Number}
*/
var getViewportHeight = function() {
return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
};

/**
* Determine the document's height
Expand Down Expand Up @@ -502,4 +511,4 @@

return smoothScroll;

});
});