Is there a way to determine the distance from the top of the page to where a link has been inserted?
For example, we can use the following code snippet to calculate the height of the window:
w = $(window).height();
I am interested in finding out how to calculate the height of an anchor tag as well.
<a href="#" id="calc"></a>
Specifically, I want to know the distance from the header to where that anchor is located.
outerh = $('#calc').outerHeight();
innerh = $('#calc').innerHeight();
After testing the above code, it seems to return a height of 18px
, which appears to be the height of the anchor tag itself.