开发者

swap jquery backgroundColor for background image?

开发者 https://www.devze.com 2022-12-29 09:10 出处:网络
A friend gave me a sol开发者_运维问答ution that uses this jquery code: .css({ backgroundColor: \'#ddd\' })

A friend gave me a sol开发者_运维问答ution that uses this jquery code:

.css({ backgroundColor: '#ddd' })

Instead, i'd like to use a background image. How do I change the jquery code to do that?

I'm wanting to do something like

.css({ backgroundImg: 'images/newsletter-dropdown.jpg' })

Thanks!


Easy as pie:

$( element ).css({ 'background-color': 'transparent', 'background-image': 'images/newsletter-dropdown.jpg' });
0

精彩评论

暂无评论...
验证码 换一张
取 消