(timestamp)
| 156 | currentTime = null; |
| 157 | |
| 158 | var animateScroll = function(timestamp){ |
| 159 | if (!currentTime) currentTime = timestamp; |
| 160 | var progress = timestamp - currentTime; |
| 161 | if(progress > duration) progress = duration; |
| 162 | var val = Math.easeInOutQuad(progress, start, final-start, duration); |
| 163 | window.scrollTo(0, val); |
| 164 | if(progress < duration) { |
| 165 | window.requestAnimationFrame(animateScroll); |
| 166 | } else { |
| 167 | cb && cb(); |
| 168 | } |
| 169 | }; |
| 170 | |
| 171 | window.requestAnimationFrame(animateScroll); |
| 172 | }; |