javascript - Jquery.css 不应用背景图像

标签 javascript jquery css

我有一些 Javascript 在 Ajax 发布后触发。

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.

我正在运行以下代码,我可以看到正在设置字体大小,但背景图像没有设置。

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%"});

关于javascript - Jquery.css 不应用背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35071786/

相关文章:

javascript - 如果存在 doctype,scrollTop() 返回 0

c# - 将任何 Jquery 插件转换为 .NET 服务器控件

javascript - 为什么我的 for 循环重复我的值?

javascript - 在 ng-if 中允许大写和小写

php - 新手 ajax (jquery) 问题

css - 对齐淡入淡出图像

css - 为什么动画延迟不起作用?

javascript - IE 不应用 &lt;style&gt; 内容的奇怪案例

javascript - 使用 browserify 无法找到 Breeze 模块

javascript - JQuery Mobile slider 未重新启用