Vertical centre a div on a page
<p>I have a question. I want to align a div on the vertical centre off the browser viewport. I understand how to do this and have written some code myself. But there is one thing that does not work:</p>

<pre><code>// fetch al info I need
var windowHeight = $(window).height();
var pageTop = $(window).scrollTop();
var modalHeight = "98";

// Get the centre of the window   
var divTop = (windowHeight - modalHeight) / 2;
// Add the scrollTop so the div will align in the middle of my current browser viewport    
var divTop = divTop + pageTop;
var divTop = divTop + "px";
$('#modal_placeholder').css('top',divTop);
</code></pre>

<p>Now, the problem is that it will not get the correct scrollTop value ... it always says it's 0, like you are currently at the top of the page.</p>

<p>Can you help me out??</p>
