MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / scrollToTop

Function scrollToTop

core/src/utils/content/index.ts:65–77  ·  view source on GitHub ↗
(el: HTMLElement, durationMs: number)

Source from the content-addressed store, hash-verified

63 * using the public API `scrollToTop` with a duration.
64 */
65export const scrollToTop = (el: HTMLElement, durationMs: number): Promise<void> => {
66 if (isIonContent(el)) {
67 const content = el as HTMLIonContentElement;
68 return content.scrollToTop(durationMs);
69 }
70 return Promise.resolve(
71 el.scrollTo({
72 top: 0,
73 left: 0,
74 behavior: durationMs > 0 ? 'smooth' : 'auto',
75 })
76 );
77};
78
79/**
80 * Scrolls by a specified X/Y distance in the component. If an `ion-content` is found, it will scroll

Callers 2

startStatusTapFunction · 0.90

Calls 2

isIonContentFunction · 0.85
scrollToTopMethod · 0.80

Tested by

no test coverage detected