Skip to content

Instantly share code, notes, and snippets.

@lyleunderwood
Created June 12, 2019 12:56
Show Gist options
  • Save lyleunderwood/3e2ce30682dda5f5f882e48159c2ab0e to your computer and use it in GitHub Desktop.
Save lyleunderwood/3e2ce30682dda5f5f882e48159c2ab0e to your computer and use it in GitHub Desktop.
type ScrollToOptions = {
top?: number;
left?: number;
behavior?: 'auto' | 'smooth';
}
declare class ScrollingElement extends Element {
scroll(x: number, y: number): void;
scroll(options: ScrollToOptions): void;
scrollTo(x: number, y: number): void;
scrollTo(options: ScrollToOptions): void;
scrollBy(x: number, y: number): void;
scrollBy(options: ScrollToOptions): void;
}
export const asScrollingElement = (element: Element): ScrollingElement =>
(element: any);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment