A Swiss Army knife for developers.
C# blazorcross-platformcsharpdesktopdesktop-appdesktop-applicationdeveloper-toolsextensiblefluentfluent-designlinuxmacosmicasyntax-highlightingtypescriptwindowswindows-10windows-11winui
export function scrollToElement(scrollViewer: HTMLElement, elementToScrollToId: string): void {
const elementToScrollTo = document.getElementById(elementToScrollToId);
if (elementToScrollTo != null) {
const absoluteElementTop = elementToScrollTo.offsetTop - scrollViewer.offsetTop;
const middle = absoluteElementTop - (scrollViewer.offsetHeight / 2);
scrollViewer.scrollTop = middle;
}
}