smooth-scroll

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

commit
f0bed65ab7c06cf5bb621541aa1842e5d1d5fc2a
parent
e6e3cc954601d869356d7c9d16eb3faebf9451e2
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-03-25 09:27
Document usage

Diffstat

M README.md 28 ++++++++++++++++++++++++++++

1 files changed, 28 insertions, 0 deletions


diff --git a/README.md b/README.md

@@ -23,3 +23,31 @@ improve existing solutions instead. This is just my personal scratchpad.
   23    23 | project is active                                   |  ~  |  ~  | yes | yes | no  | no  | yes | yes | no  |
   24    24 | supports containers other than full page            | no  | no  | no  | no  | no  | no  |  ?  | yes | no  |
   25    25 | change direction mid-scroll                         |  ?  |  ?  |  ?  |  ?  |  ?  |  ?  |  ?  |  ?  |  ?  |
   -1    26 
   -1    27 # Usage
   -1    28 
   -1    29 ## init(options)
   -1    30 
   -1    31 Register click handlers for all elements matching `options.selector`.
   -1    32 Options are:
   -1    33 
   -1    34 -   `selector` (string) - defaults to `[href^="#"]`
   -1    35 -   `headerSelector` (string) - defaults to `[data-scroll-header]`
   -1    36 -   `duration` (number) - defaults to 400
   -1    37 -   `easing` (function) - defaults to `cubicInOut()`
   -1    38 
   -1    39 If the file is included directly (i.e. not via commonjs or amd module systems)
   -1    40 this function is **called automatically**.
   -1    41 
   -1    42 ## smoothScrollToSelector(selector, options)
   -1    43 
   -1    44 Scroll to the first element matching `selector`.
   -1    45 
   -1    46 ## smoothScrollTo(endX, endY, options)
   -1    47 
   -1    48 Low-level function that scrolls to the given position. The header is ignored.
   -1    49 
   -1    50 ## animate(apply, duration)
   -1    51 
   -1    52 Low-level function that calls `apply(progress)` on each animation frame.
   -1    53 `progress` is a number between 0 and 1.