@prudaily/scroll-into-view-if-needed
Version:
Element.scrollIntoViewIfNeeded ponyfill that can animate the scrolling
13 lines (11 loc) • 337 B
TypeScript
export interface ScrollIntoViewIfNeededOptions {
centerIfNeeded?: boolean;
duration?: number;
easing?: 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'linear';
}
export default function scrollIntoViewIfNeeded(
node: Element,
centerIfNeeded: boolean,
options?: ScrollIntoViewIfNeededOptions,
finalElement?: Element
): void;