How do I find the vertical distance from the top of the page to where the element exist in the DOM using javascript/jQuery?
I've something like
<ul>
<li>one</li>
<li>one</li>
<li>one</li>
<li>one</li>
<li class="test">one</li>
....
....
....
<li>one</li>
</ul>
For example here, I want to find the vertical distance from top of the page to the li#test
element.
我试了.scrollTop()
,但总是0!