Namespace: Scroll

Scroll

Smooth scrolling service from http://jsfiddle.net/brettdewoody/y65G5/

Methods


Scroll.scrollTo(target, focus, percentage)

Scroll to a field.
Parameters:
Name Type Description
target The element to scroll to. Can be an item ID, an Angular element, or a number (yPos).
focus boolean If `true`, focus will be transfered to the target's first `input` element.
percentage number The offset (in percent) from the top of the screen.
Returns:
Returns a promise that resolves once the animation on an element completes.
Type
Promise
Examples

Scroll to the "firstName" component.

Scroll.scrollTo("firstName");

Scroll to and focus on the "firstName" component.

Scroll.scrollTo("firstName", true);

Scroll to the "firstName" component with an offset of 25%.

Scroll.scrollTo("firstName", false, 25);

Scroll to the "firstName" component with an offset of 50%.

// Regular syntax
Scroll.scrollTo("firstName", false, 50);

// A value of "true" for the third argument is interpreted as "50"
Scroll.scrollTo("firstName", false, true);

Scroll 100 pixels down the page.

Scroll.scrollTo(100);