When user scrolls to the bottom of the page I want to show some div, with jQuery of course. And if user scrolls back to he top, div fade out. So how to calculate viewport (o
$(document).scrollTop() should give you the position of scrollbar. you check that against document height. then fade in or out the div.