Reputation: 7003
I need to detect how far from top the document has been scrolled and for that I used scrollTop()
. Unfortunatelly it doesn't work on some versions of Android and therefor I need a different solution. Is there a way I could get the $(document).scrollTop
without scrollTop
function?
Upvotes: 4
Views: 2679
Reputation: 15668
This worked for me, hope it works for you too
var body = document.body;
var docElem = document.documentElement;
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
Upvotes: 6
Reputation: 6099
You can try window.pageYOffset
to determine the offset from the top. E.G:
alert(window.pageXOffset + window.pageYOffset);
Upvotes: 0