Skip to content

Commit

Permalink
new _getTargetAnchor implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
schlosser committed Mar 9, 2016
1 parent 4e92763 commit a005177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/pageanimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@
* @returns {Node} the anchor element
*/
function _getTargetAnchor(e) {
var url;
if (e.target.href) {
return e.target;
} else {
for (var i = 0; i < e.path.length; i++) {
if (e.path[i].href) {
return e.path[i];
}
var target = e.target;
while (target.parentNode) {
if (target.href) {
return target;
}
target = target.parentNode;
}
}

Expand Down Expand Up @@ -245,7 +242,6 @@
percentComplete = elapsed / scrollDuration;
scrollToPercent = _easeInOutQuad(percentComplete, elapsed, 0, 1, scrollDuration);
scrollToY = scrollToPercent * distanceToTravel + startY;
console.log(percentComplete, elapsed, scrollToPercent, scrollToY, startY);
window.scrollTo(0, scrollToY);
requestAnimationFrame(step);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pageanimation.min.js

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

0 comments on commit a005177

Please sign in to comment.