A promise based angular.js service to facilitate animated scrolling
- Exposes a service that scrolls an arbitrary element to another element's location.
- Promise enabled: The service returns a promise and resolves upon completion of the scroll operation.
- Selector enabled: Use CSS selectors to specify to which element to scroll.
window.getAnimationFrame()for a smooth and efficient scroll animation
- Clean: No classes, no jQuery, no CSS, just plain Angular.js
- Install the ngAnimatedScroll package
npm install ng-animated-scroll --save
bower install ng-animated-scroll --save
- Include the library into your application:
if installed via NPM include from
if installed via Bower include from
Add a dependency to
AnimatedScrollto your appangular;
animatedScrollservice into your directive, factory, controller, etc. and call it's
Example: Simple scroll operation
Example: Using CSS selectors
Example: Leveraging the promise
Example: Scrolling within an Element
Element | angular.element | selector (string)
The element to scroll to. This can be an angular.element, (HTML)Element or CSS selector string.
Options for the scroll operation. (See Options)
The duration of the scroll animation in milliseconds.
An offset to the element's top at which to stop scrolling.
The easing function to be used for the animation. Currently supported are:
Element | angular.element | selector (string) Default:
The element to scroll. This can be an angular.element, (HTML)Element or CSS selector string.
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.