getVerticalOffset
Finds the distance from a given element to the top of the document.
- Use a
whileloop andHTMLElement.offsetParentto move up the offset parents of the given element. - Add
HTMLElement.offsetTopfor each element and return the result.