├── bower.json ├── package.json ├── LICENSE.md ├── README.md └── animatedScrollTo.js /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "animated-scrollto", 3 | "version": "1.1.0", 4 | "main": "animatedScrollTo.js" 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "animated-scrollto", 3 | "version": "1.1.0", 4 | "description": "Animated scrolling without any dependency on libraries", 5 | "main": "animatedScrollTo.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/madebysource/animated-scrollto" 9 | }, 10 | "bugs": { 11 | "url": "https://github.com/madebysource/animated-scrollto/issues" 12 | }, 13 | "author": "Marek Hrabe (https://github.com/marekhrabe)", 14 | "license": "MIT" 15 | } 16 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Piffle, LLC. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Animated scrollTo 2 | 3 | This is a simple function for animating scroll. 4 | 5 | - No dependency on extra libraries. 6 | - If user scrolls while animation is running, scroll animation would be immediately canceled. 7 | - Use as a single script or through browserify/webpack. 8 | 9 | ## Example usage 10 | 11 | ```javascript 12 | button.addEventListener('click', function () { 13 | animatedScrollTo( 14 | document.body, // element to scroll with (most of times you want to scroll with whole ) 15 | 0, // target scrollY (0 means top of the page) 16 | 10000, // duration in ms 17 | function() { // callback function that runs after the animation (optional) 18 | console.log('done!') 19 | } 20 | ); 21 | }); 22 | ``` 23 | 24 | This will scroll to top of the page and the animation will run for 10 seconds (10000ms). 25 | 26 | ## Import as an external script 27 | 28 | Just import this library with `