title: Get an element position relative to the top of the viewport
body: <p>I need to get the top position of an element relative to the top of the viewport, not the whole document.</p>
  
  <p>I tried <code>offset().top;</code> which returns the top position relative to the document, and I tried <code>scrollTop()</code> which always returns <code>0</code> regardless of the element's visibility in the viewport.</p>