[Greasemonkey] What DOM node is visable at the top of a window?

Roderick McGuire mcguire at telerama.com
Mon Feb 6 15:49:08 EST 2006


I have a gm script that scrapes out a an array of nodes, say called 
headerNodes, and then adds a {position: fixed;} div with buttons that 
scrolls you to the next or previous header. E.g.

headerNodes[i].wrappedJSObject.scrollIntoView();

It works fine. However if the user manually scrolls the window, I would 
like + to scroll to the next header after what appears in the top of the 
window.

If I could figure out what DOM node is shown at the top of the window, I 
could use compareDocumentPosition to figure out what headerNode to 
scroll to.

But I don't see how to find this info.

Thanks in advance for any info.





More information about the Greasemonkey mailing list