I need to take this question one step further.
The div I have is centered vertically using the following code:
var boxheight = $('#notifications').height();
var windowheight = $(window).height();
var boxheight = $('#notifications').height();
var pagecenterH = ((windowheight-boxheight)/2);
$('#notifications').animate({'top': pagecenterH});
That works great if the page is only as tall as the window, but if the page is much longer and the user is halfway down the page when they click to open the #notifications
code above, the div appears centered from the top of the screen, so they may miss the box altogether.
How can I get the code to recognize where on the page the user is so that the div will appear vertically centered no matter how far down they scroll?
Thanks in advance!