smooth-scroll

simple smooth scrolling in the browser
git clone https://git.ce9e.org/smooth-scroll.git

commit
47b0926617f68e9cd140523e5a39405d68cb3698
parent
231d1a85f2a531d1c0ea41f040764e9bee161659
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2016-11-18 17:17
Revert part of "add parameters container and duration"

This reverts commit 6cf960e11141826ebfcb367605bc3427f8a8f193.

Diffstat

M TODO 1 +
M smooth-scroll.js 7 +++----

2 files changed, 4 insertions, 4 deletions


diff --git a/TODO b/TODO

@@ -6,3 +6,4 @@
    6     6 # wontfix
    7     7 
    8     8 -	horizontal scrolling
   -1     9 -	other containers

diff --git a/smooth-scroll.js b/smooth-scroll.js

@@ -24,16 +24,15 @@
   24    24     window.requestAnimationFrame(step);
   25    25   };
   26    26 
   27    -1   var smoothScrollTo = function(endY, container, duration) {
   28    -1     container = container || window;
   -1    27   var smoothScrollTo = function(endY, duration) {
   29    28     duration = duration || 400;
   30    29 
   31    -1     var startY = container.scrollY;
   -1    30     var startY = window.scrollY;
   32    31 
   33    32     animate(function(progress) {
   34    33       // var f = Math.sin(Math.PI * (progress - 0.5)) / 2 + 0.5;
   35    34       var f = (3 - 2 * progress) * progress * progress;
   36    -1       container.scrollTo(0, startY * (1 - f) + endY * f);
   -1    35       window.scrollTo(0, startY * (1 - f) + endY * f);
   37    36     }, duration);
   38    37   };
   39    38