|
|
|
@ -24,8 +24,8 @@ export default function scrollTo(y: number, options: ScrollToOptions = {}) {
|
|
|
|
|
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
|
|
|
|
|
if (isWindow(container)) {
|
|
|
|
|
(container as Window).scrollTo(window.pageXOffset, nextScrollTop);
|
|
|
|
|
} else if (container instanceof Document) {
|
|
|
|
|
container.documentElement.scrollTop = nextScrollTop;
|
|
|
|
|
} else if (container instanceof HTMLDocument || container.constructor.name === 'HTMLDocument') {
|
|
|
|
|
(container as HTMLDocument).documentElement.scrollTop = nextScrollTop;
|
|
|
|
|
} else {
|
|
|
|
|
(container as HTMLElement).scrollTop = nextScrollTop;
|
|
|
|
|
}
|
|
|
|
|