Skip to content

Instantly share code, notes, and snippets.

@borispoehland
Created February 23, 2021 15:04
Show Gist options
  • Save borispoehland/41ba58d95cb58101c3c6791461a346f1 to your computer and use it in GitHub Desktop.
Save borispoehland/41ba58d95cb58101c3c6791461a346f1 to your computer and use it in GitHub Desktop.
export const getTopY = (element: HTMLElement, downOffset: number): number => {
return element.getBoundingClientRect().top + window.pageYOffset - downOffset;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment