Jquery 删除不工作的背景图像
我已经尝试了以下所有方法来删除背景图像,但直到我使用了标记为答案的解决方案,它才起作用Jquery 删除不工作的背景图像,jquery,css,asp.net-mvc,Jquery,Css,Asp.net Mvc,我已经尝试了以下所有方法来删除背景图像,但直到我使用了标记为答案的解决方案,它才起作用 $(document.body).on("click", "#lnkFAQ", function () { document.getElementById("bodyContent").style.backgroundImage = ''; document.getElementById("bodyContent").style.height = 10; if (document.
$(document.body).on("click", "#lnkFAQ", function () {
document.getElementById("bodyContent").style.backgroundImage = '';
document.getElementById("bodyContent").style.height = 10;
if (document.all) {
document.body.style.removeAttribute('background-image');
}
else {
document.body.style.removeProperty('background-image');
}
$("#bodyContent").css("background-image",'url("")');
});
还有Site.css
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
height: 100%;
background-image: url("/Content/Img/MainPageBackground.jpg");
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: 100% 100%;
background-position: center;
}
或
你是不是先用谷歌搜索过?我没有否决你:)@user1477388你的链接很好。不知道我怎么会错过它。谢谢你提供的信息+1此选项更改元素的所有样式,而不是OP要求的样式。
$("#bodyContent").css("background-image",'none');
$("#bodyContent").attr("style","background-image:none");