Ah excellent - using console.log($(this).css("backgroundColor")) in the
second function shows the parent elements background colours as an array:

transparent
transparent
rgb(51, 51, 51)
transparent
transparent

so that means I'm on the right track, I've just stuffed up the if statement.
I'll keep working on it. :)

Thanks for the help.



Daemach2 wrote:
> 
> Try doing console.log($(this).css("backgroundColor")) in the second
> function to see what those background colors are showing up as.
> 
> 
> 
> Yansky wrote:
>> 
>> I'm having a bit of trouble figuring out how to do this. What I'd like to
>> do is find the first parent element that has a background color that is
>> not transparent.
>> 
>> This is what I've tried so far, but with no success:
>> 
>> $('.elemToFade:first').parents("[EMAIL PROTECTED] !=
>> 'transparent']:first");
>> 
>> this also didn't work:
>> 
>> $('#theDiv').parents().each(function(i){
>> if($(this).css("backgroundColor") != "transparent"){
>>   return.this[0];}
>> });
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Find-first-parent-element-with-certain-style-tf3429157.html#a9559529
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to