55
66Allows animating ` scrollTop ` and/or ` scrollLeft ` of an HTML element. Uses
77` requestAnimationFrame ` to provide smooth animations and returns a ` Promise ` to
8- notify when the animation is completed. To ensure compatibility with older
9- browsers, add polyfills for ` requestAnimationFrame ` and ` Promise ` as needed.
8+ notify when the animation is completed.
109
1110### Installation
1211Install with bower:
@@ -26,11 +25,11 @@ The pre-built files can be found in the `dist/` directory.
2625wrapper so you can access it as:
2726
2827``` javascript
29- var AnimatedScroll = require (' dist/AnimatedScroll.min.js ' );
28+ var AnimatedScroll = require (' animated-scroll ' );
3029// or
31- import AnimatedScroll from ' dist/AnimatedScroll.min.js ' ;
30+ import AnimatedScroll from ' animated-scroll ' ;
3231// or
33- define ([ ' dist/AnimatedScroll.min.js ' ], function (AnimatedScroll ) {});
32+ define ([ ' path/to/animated-scroll ' ], function (AnimatedScroll ) {});
3433// or
3534var AnimatedScroll = window .AnimatedScroll ;
3635```
@@ -50,10 +49,7 @@ scroll.left(100).then(function (newLeft) {
5049 console .log (' #myElement\' s scrollLeft is now' , newLeft);
5150});
5251
53- scroll .to ({
54- left: 100 ,
55- top: 100
56- }).then (function (coords ) {
52+ scroll .to ({ left: 100 , top: 100 }).then (function (coords ) {
5753 console .log (' #myElement\' s scrollTop is now' , coords .top );
5854 console .log (' #myElement\' s scrollLeft is now' , coords .left );
5955});
0 commit comments