Reputation: 137
noob-ish question here, I'm working on a project using the last jQ Mobile (1.4.2) I have a page which is longer than the height of the device and I need to know the position of the currently displayed things ( e.g. 0 if I am at the top , height-deviceheight if I am at the bottom of the page).
Any Hints?
Upvotes: 1
Views: 1091
Reputation: 2667
You are looking for a scroll event listener such as scroll()
and with that you can use scrollTop()
to find out the position of the scroll, like so:
$(window).scroll(function () {
$('p').text("Scrolled " + $(window).scrollTop() + " pixels");
});
Upvotes: 1