I'am not sure, but this one may be faster:

// get the background color
var current_p = $(this);
var bg = "transparent";
while(bg == "transparent") {
        bg = current_p.parent().css('background-color');
        current_p = current_p.parent();
}

On 16 jun, 23:10, Fil <[EMAIL PROTECTED]> wrote:
> To retrieve the computed bgcolor of an element I had to do this:
>
> var bgcolor = jQuery(this).css('backgroundColor');
> if (bgcolor == 'transparent') {
>         jQuery(this)
>         .parents()
>         .each(function(){
>                 var bg = jQuery(this).css('backgroundColor');
>                 if (bg != 'transparent'
>                 && bgcolor == 'transparent')
>                         bgcolor = bg;
>         });
>
> }
>
> I hated it: is there not already a plugin doing this (and probably
> doing it better)?
>
> -- Fil

Reply via email to