Steve
Steve

Reputation: 4918

Setting mulltiple CSS3 backgrounds with jQuery

I'd like to know the proper way to set CSS3 multiple backgrounds for an element with jQuery. I want to end up with

content #{
  background:
    url(images/snapGrid2.gif) left top,
    url(clientImages/vector-old-paper-1627.jpg);
}

Thanks

Upvotes: 0

Views: 48

Answers (2)

Jaime Gris
Jaime Gris

Reputation: 1126

Here it is.

$('.mbg').css('background', 'url(http://placehold.it/300x200) left top no-repeat, url(http://placehold.it/300x200) right bottom no-repeat')

Yep, it is basically the same as setting a single background image.

See it for yourself: jsFiddle.

Upvotes: 2

Brad
Brad

Reputation: 417

Check out this plug-in I found for multiple backgrounds using jQuery here

Upvotes: 1

Related Questions