Skip to content
Snippets Groups Projects
Commit 80fc53d7 authored by Daniel Kurowski's avatar Daniel Kurowski
Browse files

Added scrollToElement() method

parent 40d25197
Branches
Tags
1 merge request!8Resolve "Expose manual scrollTo*() methods to public API"
import * as Velocity from 'velocity-animate';
import {EASE_IN_SKIP_OUT_EASING} from '../easing/setupVelocity';
export function scrollToElement(element: HTMLElement, onScrollFinishedCallback?: () => void): void
{
Velocity.animate(element, 'scroll', {
duration: 1200, // todo: different depending on offset from page top?
easing: EASE_IN_SKIP_OUT_EASING,
complete: () => onScrollFinishedCallback !== undefined && onScrollFinishedCallback(),
});
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment