OT Javascript - when is an element visible

2008-02-12 Thread Adrian Lynch
Sorry for the OT... I have a parent div, which contains many child divs. The parent div is set to scroll when it's content is to big. What I'm trying to work out, is a way to find out when one of those child divs is visible and when it's not. I thought maybe scrollTop or offsetTop but I'm low

Re: OT Javascript - when is an element visible

2008-02-12 Thread Rey Bango
In Ext, the Element class has built-in methods to get just about anything you need from an element, including position info. http://extjs.com/deploy/dev/docs/?class=Ext.Element jQuery, out of the box, can provide offset, width and height only and enhanced capabilities via the dimensions

Re: OT Javascript - when is an element visible

2008-02-12 Thread Massimo Foti
Doesn't sound fun though-- maybe someone will post and show us a pre-built function in the prototype library or something. :) Many libraries include a method to get the coordinates of any element. Right now I am thinking just about the one available in Mootools:

RE: OT Javascript - when is an element visible

2008-02-12 Thread Jim Davis
-Original Message- From: Rey Bango [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 12, 2008 3:50 PM To: CF-Talk Subject: Re: OT Javascript - when is an element visible In Ext, the Element class has built-in methods to get just about anything you need from an element, including

Re: OT Javascript - when is an element visible

2008-02-12 Thread s. isaac dealey
I'm not sure if scrollTop is part of the spec for DOM (or widely supported -- innerHTML for example is not but widely supported). Assuming that scrollTop is supported in the browser though, I'd think something like this might work: var ct = container.scrollTop; var ch = container.offsetHeight;

RE: OT Javascript - when is an element visible

2008-02-12 Thread Brad Wood
I know there is a JS method called .scrollIntoView() (IE only??) which will cause the an element to scroll to where it is visible. Not sure how to tell if it is visible though. I suppose if you know the edges of the viewable area, you can calculate the position of the element in question via its