【发布时间】:2014-11-08 03:21:25
【问题描述】:
我想在语法上修改标签的图像,它不仅适用于设备(Android、iOS)。它在 Chrome/桌面上运行良好。
我尝试了 Div、Span 和 Img 标签,但都具有相同的行为。
请指导我如何更改背景图像。
我已经搜索了 no# 个问题并尝试了选项,但对我来说没有任何效果。
HTML
<div class="healthCare_heading">
<span class="healthCare_heading span" onclick="Utilities.switchResultsULMaps('PageUL', 'MapsDiv')"></span>
</div>
CSS
.healthCare_heading {
float: left;
width: 100%;
box-shadow: inset 0 0 0 1000px rgba(13, 13, 13, 0.8);
}
.healthCare_heading span {
float: right;
margin-right: 0;
background-image: url(../images/phone/1x/healthIcon.png) ;
background-size: 25px 25px;
width: 30px;
height: 30px;
background-position: center;
background-color: rgba(16,138,177,0.6);
}
我正在使用下面的JS代码来改变背景。
$(".healthCare_heading span").attr("style", "background-image:url(../images/phone/1x/healthCareBar_icon.png) no-repeat;margin-left: 0;background-size: 25px 25px;width: 30px;height: 30px;background-position: center;background-color: rgba(16,138,177,0.6);");
注意:- 我也试过 background-image:url() 和 background:url() 但两者都不能在设备上工作。
【问题讨论】:
-
你找到解决办法了吗?
标签: javascript jquery css cordova