You can create your own pseudo-class selector:

$.extend($.expr[ ":" ], {
trulyVisible : "$(a).is(':visible') && !$ (a).parents(':hidden').length"
});

Remy Sharp wrote about this a while back, and constructed the filter a little bit differently, but it should have the same effect:

http://remysharp.com/2008/10/17/jquery-really-visible/


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Nov 26, 2008, at 3:37 AM, schellmax wrote:


hello,
is there a selector or something to detect the visibility of a nested
element?
for example, i got the following:

<div style="display:none"><p>Invisible text</p></div>

'p:visible' will return the preceding p-tag, although it's not visible
at all, as it's parent isn't.

do i have to loop through all parents and check their 'display'
property or maybe there's a more elegant solution to this?

max

Reply via email to