简体   繁体   中英

Jquery.css not applying Background-Image

I have some Javascript which fires after an Ajax post.

When the javascript fires I want the <section class="section-1653"> to be given a different background image to the one specified in the CSS file.

I am running the following code and I can see the Font Size being set, but the background image is not.

Why is the background image property not being set?

$("section.section-1653").css({"background-image": backgroundImageUrl,font-size": "200%"});

图片必须在url()之内

$("section.section-1653").css({"background-image": "url("+backgroundImageUrl+")", "font-size": "200%"});

需要将其设置为:

$("section.section-1653").css({"background-image", "url('+ imageUrl +'), "font-size": "200%"});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM