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

Exposed scrollTo*() methods through API

parent 62889442
No related branches found
No related tags found
1 merge request!8Resolve "Expose manual scrollTo*() methods to public API"
......@@ -2,6 +2,10 @@ import * as Velocity from 'velocity-animate';
import setupVelocity from './easing/setupVelocity';
import {initializeOnLoadScroll} from './handlers/loadScroll/initializeOnLoadScroll';
import {initializeOnLinkClickScroll} from './handlers/linkClickScroll/initializeOnLinkClickScroll';
import {scrollToElement} from './scrollers/scrollToElement';
import {scrollToOffset} from './scrollers/scrollToOffset';
import {scrollToTarget} from './scrollers/scrollToTarget';
import {HashTarget} from './HashTarget';
export interface SmoothScrollOptions {
readonly scrollOnLoad?: boolean;
......@@ -9,7 +13,7 @@ export interface SmoothScrollOptions {
}
/**
* Wrapped into class for intuitive API use – `SmoothScroll.enable()`
* Wrapped into class for intuitive API use – `SmoothScroll.something()`
*/
class SmoothScroll
{
......@@ -25,6 +29,21 @@ class SmoothScroll
initializeOnLinkClickScroll();
}
}
public static scrollToElement(element: HTMLElement, onScrollFinishedCallback?: () => void): void
{
scrollToElement(element, onScrollFinishedCallback);
}
public static scrollToOffset(topOffset: number, onScrollFinishedCallback?: () => void): void
{
scrollToOffset(topOffset, onScrollFinishedCallback);
}
public static scrollToTarget(target: HashTarget, onScrollFinishedCallback?: () => void): void
{
scrollToTarget(target, onScrollFinishedCallback);
}
}
export default SmoothScroll;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment