How do you bind it so that when a user scrolls, I can know the "offset" from the top, in pixels?
views:
20answers:
2
A:
var p = $("p:last");
var offset = p.offset();
p.html( "left: " + offset.left + ", top: " + offset.top );
powtac
2009-11-20 21:50:07
No, this is not what I mean. I'd like to know...for example...if a person scrolls down 100 pixels, I'd like to know that it's 100 pixels.
TIMEX
2009-11-20 21:59:53
Ok, check the answer of David!
powtac
2009-11-20 22:04:34
+2
A:
$(document).scroll(function(e) {
var offset = $(e.target).scrollTop();
});
David
2009-11-20 22:03:26