anyone know how to determine how far down the current page, the user has scrolled?

basically i need certain elements of the page to stay fixed relative to the screen when the user scrolls the page. i figured i could do this if i knew how far the page has been scrolled