title: Get percentage of scroll position
body: <h2>The problem:</h2>
  <p>What would be the mathematical formula to calculate (regardless of the
  <code>scrollHeight</code> of the document) how far the bottom of the scrollbar is from it's total bottom (which would be the end of the page). So, for example, when the scrollbar is at the top, I would say the distance in percentages of the bottom of it, from the bottom of the document, would be <strong>0%</strong>, and when it's totally scrolled all the way (vertically), it would be <strong>100%</strong>.</p>
  <h2>My goal:</h2>
  <p>My goal is to calculate how many pixels there are between the bottom and a specific position which is, let's say <strong>3%</strong>, relative to the viewport, above that bottom. Again, the document height should mean nothing. 3% are 3% if it's relative to the viewport.</p>
  <h2>Known variables:</h2>
  <pre><code>var P              = 3 // in %
  var totalHeight    = document.documentElement.scrollHeight;
  var viewportHeight = document.documentElement.clientHeight;
  </code></pre>