element visibility during scrolling

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
 
B

B Wisentaner

Did you try CSS style { position: fixed; right: whatever; top:
whatever; } ?

---Bruce Wisentaner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top