web-ui-pack
Version:
Web package with UI elements
17 lines (16 loc) • 682 B
TypeScript
export interface WUPScrollOptions {
/** Scroll animation time; Set 0 or null to disable
* @defaultValue 400 */
smoothMs?: number;
/** Offset that must be applied to scrollTop;
* @defaultValue -30 */
offsetTop?: number;
/** Offset that must be applied to scrollLeft;
* @defaultValue -30 */
offsetLeft?: number;
/** Scroll only if element out of view;
* @defaultValue true */
onlyIfNeeded?: boolean;
}
/** Scroll the HTMLElement's parent container such that the element is visible to the user and return promise by animation end */
export default function scrollIntoView(el: HTMLElement, options?: WUPScrollOptions): Promise<void>;