M
Mira
Hi,
I'm trying to figure out which elements of a document are visible as
the user scrolls the Firefox browser. I haven't written the code yet
but I think I should be able to do it by keeping track of the current
display using the following properties:
window.content.scrollX, window.content.scrollY,
window.content.innerWidth, window.content.innerHeight. -- with these 4
I can determine which part of the document is visible.
Then for each element I can figure out its display position using,
offsetWidth, offsetHeight, offsetTop, offsetLeft. This would entail
traversing the DOM and perculating the offset values down to all the
children.
While this would likely work, it seems inefficient. Do you know of any
other ways to determine which elements are actually on the screen?
Thanks.
Mira
I'm trying to figure out which elements of a document are visible as
the user scrolls the Firefox browser. I haven't written the code yet
but I think I should be able to do it by keeping track of the current
display using the following properties:
window.content.scrollX, window.content.scrollY,
window.content.innerWidth, window.content.innerHeight. -- with these 4
I can determine which part of the document is visible.
Then for each element I can figure out its display position using,
offsetWidth, offsetHeight, offsetTop, offsetLeft. This would entail
traversing the DOM and perculating the offset values down to all the
children.
While this would likely work, it seems inefficient. Do you know of any
other ways to determine which elements are actually on the screen?
Thanks.
Mira