Possible Duplicate:
Can you get the user’s scroll position every time they scroll with JavaScript/jQuery?
I am trying to write something in JavaScript/Jquery on the use of scroll events.
Here is where I started but I can’t seem to figure out how to get scroll value.
I am looking for is the class/method to find the current scroll
position on the page.
Any help is greatly appreciated.
$(document).ready(function () {
$(window.parent.document).scroll(function () {
var scroll_info = X;//X == the method/class of getting scroll value
if (scroll_info > 40) {
//show
$('#ArrowImage').show(1000);
} else {
//hide
$('#ArrowImage').hide(1000);
}
});
});
You could likely use both JQuery’s .prop and .scrollTop methods to retrieve the position of the vertical scroll bar, for the element you’re trying to scroll. Here’s an example that combines a little of each of those to scroll a textbox to its bottom:
To find the currently scrolled top, you would use something like this:
What you seem to be looking for is: