[Greasemonkey] window.bottom?

Roderick McGuire mcguire at telerama.com
Wed Apr 5 01:01:23 EDT 2006


I want to find the bottom of a window (for now for scrolling purposes in 
a script).

One would think that the correct value would be:
   "bottomY = window.scrollY + window.innerHeight"

However according to [1] .innerHeight "Gets the height of the content 
area of the browser window including, if rendered, the horizontal 
scrollbar." This is correct. If you scroll to the above bottom you will 
go past something covered up by the horizontal scroll bar.

I have not been able to find any way to see if a window has a 
"horizontal scrollbar" visible or how to determine the scroll bar 
height. And this messes up precise scrolling.

However CSS lets you position things at the real bottom not the 
scrollbar bottom. For now I can add a fixed bDIV at the bottom

   GM_addStyle('#bottemDiv {position: fixed; bottom: 0}')

Then I calculate "bottomY = bDIV.offsetTop + bDIV.clientHeight"

This works. Please somebody tell me that there is some more simple way 
to find the bottom of a window.


[1] http://www.mozilla.org/docs/dom/domref/dom_window_ref.html#1011624









More information about the Greasemonkey mailing list