On Dec 13, 2006, at 1:14 PM, fullgarbage wrote:
> Hello all,
>
> How can I check if a given element is visible or not (i.e. has
> display:block).
> I have the folowing situatioin - I need to hide all <li class="label">
> elements that have ALL their <li class="clearfix"> descendant hidden.
> (if one or more of the <li class="clearfix"> descendants is
> visible, then the
> "label" must stay visible). I intend to do sometning like that:
>
> $("div.specifications li.label").each(function() {
>
> to_hide = 1;
> $(" li.clearfix", this).each(function() {
>
> if($(this).IS_VISIBLE to_hide = 0;
> })
> if($.trim(this.innerHTML) == ' ') $(this).parent
> ().parent().toggle();
>
> if(to_hide) {
>
> $(this).hide();
> }
>
> })
>
> What might IS_VISIBLE be ?
> Any hints ?
Hi Stoyan,
You could try this:
if ( $(this).is(':visible') ) {
// your code
}
If you're just trying to gather elements that are visible, you could
do something like this, too:
$('li.clearfix:visible', this).hide();
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/