scroll-into-view-if-needed
Version:
Element.scrollIntoViewIfNeeded ponyfill that can animate the scrolling
12 lines (11 loc) • 432 B
TypeScript
export interface AnimateOptions {
duration?: number;
easing?: 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'linear';
}
export interface OffsetConfig {
offsetTop?: number;
offsetLeft?: number;
offsetBottom?: number;
offsetRight?: number;
}
export default function scrollIntoViewIfNeeded(elem: Element, centerIfNeeded?: boolean, options?: AnimateOptions, finalElement?: Element, config?: OffsetConfig): void;