views:

821

answers:

3

I' trying to use window.pageYOffset & window.scrollMaxY to calculate the current page progress. This approach works under FF3.5 but under webkit window.scrollMaxY is undefined.

+1  A: 

I think you want window.scrollTop and window.scrollHeight for other browsers. window.scrollMaxY isn't supported by IE either.

Quirksmode.org is a great site for sussing out the differences in browser DOM implementations.

http://www.quirksmode.org/dom/w3c_cssom.html

Andy E
More info about scrollMaxY:- http://code.google.com/p/doctype/wiki/WindowScrollMaxYProperty
wai
A: 

I've got away with document.body.scrollHeight so that

document.body.scrollHeight = window.pageYOffset + screen height in pixels

at the end of the page (on Android).

alex
A: 

Hi, alternative to window.scrollMaxY:

document.documentElement.scrollHeight - document.documentElement.clientHeight

gives same result as window.scrollMaxY with ie7, ie8, ff3.5, Safari 4, Opera 10, Google Chrome 3 under DOCTYPE XHTML 1.0 Transitional.

panos