I want to calculate how far a page is scrolled down. I found how to do this with Internet Explorer with the following equation: (scrollFrame.document.body.scrollTop / (scrollFrame.document.body.scrollHeight - scrollFrame.document.body.clientHeight))
But I can’t find it for Mozilla. I have (scrollFrame.window.pageYOffset / (scrollFrame.document.height - scrollFrame.window.innerHeight))
The result of the equation should give 0 when you are at the top of the screen and 1 when you scrolled down. Independent of the window size of course. But that's just what the problem is: As the window size increases, the result of this equation (when you are scrolled all the way down) diverts from 1 to 2.
Some examples:
almost maximzed window at 1280 x 1024:
At the top: 0 / (830 - 756) = 0
In the middle: 48 / (830 - 756) = 0.6486486486486487
At the bottom: 94/(830 - 756) = 1.2702702702702702
maximzed window at 1280 x 1024:
At the top: 0 / (830 - 810) = 0
In the middle: 20 / (830 - 810) = 1
At the bottom: 40 / (830 - 810) = 2
I can’t figure out the solution, maybe another property of the window or document and I don’t like the solution of reinstalling my old screen so I switch back to a normal 1024x768
But I can’t find it for Mozilla. I have (scrollFrame.window.pageYOffset / (scrollFrame.document.height - scrollFrame.window.innerHeight))
The result of the equation should give 0 when you are at the top of the screen and 1 when you scrolled down. Independent of the window size of course. But that's just what the problem is: As the window size increases, the result of this equation (when you are scrolled all the way down) diverts from 1 to 2.
Some examples:
almost maximzed window at 1280 x 1024:
At the top: 0 / (830 - 756) = 0
In the middle: 48 / (830 - 756) = 0.6486486486486487
At the bottom: 94/(830 - 756) = 1.2702702702702702
maximzed window at 1280 x 1024:
At the top: 0 / (830 - 810) = 0
In the middle: 20 / (830 - 810) = 1
At the bottom: 40 / (830 - 810) = 2
I can’t figure out the solution, maybe another property of the window or document and I don’t like the solution of reinstalling my old screen so I switch back to a normal 1024x768
