Look at the network panel in firebugs or activity monitor in Safari. See what URL is being requested for the images. You can then see where there error in your path is.

--
Scott
Iphone says hello.

On Sep 12, 2009, at 11:10 PM, macsig <sigbac...@gmail.com> wrote:


Hello guys,
I have a series of divs (all with the same CSS class) and I'm trying
to add dynamically a background image to each one (each div needs a
different image) so here my code

$('.panel').css({'background-image' : 'url(../images/sub/'+ $
(this).attr("id") +'.png)'});

but unfortunately my divs don't have any background; however if I
hardcode a image, for instance

$('.panel').css({'background-image' : 'url(../images/sub/bg1.png)'});

every div has the (same) background.

Finally if I print out the image path for each div

$('.panel').each(function(){
alert('url(../images/sub/'+ $(this).attr("id") +'.png)'});
});

the path looks fine.


Am I missing something???

THANKS

Sig

Reply via email to