From ff7bd424f0805223b0ded0cfe6f91726b67be813 Mon Sep 17 00:00:00 2001 From: maxdavila Date: Wed, 29 Oct 2014 22:48:49 -0700 Subject: [PATCH] removes check for when lastpos === element.scrolltop. Since we are already stopping once now > animationStart + duration. This breaks safari scrolls since it returns false whenever lastpos !== element.scrollTop even when the animation is not done --- animatedScrollTo.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/animatedScrollTo.js b/animatedScrollTo.js index bc7d0cb..e4e324f 100644 --- a/animatedScrollTo.js +++ b/animatedScrollTo.js @@ -21,18 +21,8 @@ } requestAnimFrame(animateScroll); var now = +new Date(); - var val = Math.floor(easeInOutQuad(now - animationStart, start, change, duration)); - if (lastpos) { - if (lastpos === element.scrollTop) { - lastpos = val; - element.scrollTop = val; - } else { - animating = false; - } - } else { - lastpos = val; - element.scrollTop = val; - } + lastpos = element.scrollTop = Math.floor(easeInOutQuad(now - animationStart, start, change, duration)); + if (now > animationStart + duration) { element.scrollTop = to; animating = false;