tags:

views:

452

answers:

2

Hi

I want to apply Supersleight to my transparent png images on my site, so far I only apply it to images with a PNG image in the src attribute.

Now I want to filter through all elements with a background-image property which contains '.png'.

Can someone please suggest a query?

Thanks in advance.

+1  A: 

Never used supersleight but this should put you on the right track.

$("*").each( function()
{
    if( $(this).css("background").indexOf( ".png" ) != -1 )
    {
        $(this).supersleight();
    }
});
Kane Wallmann
A: 

I don't think that jQuery could help you much with that.

You could try parsing the whole HTML and looking for match using regular expressions:

// filename filter may require some modifications
// I just picked most common chars
$('html').html().match(/[/\w\d.-]+\.png/g);

However you must remember that you won't be able to match pngs defined in external stylesheets this way.

RaYell