【发布时间】:2019-03-06 00:53:48
【问题描述】:
我有一个 jquery 函数 addbluebody() 将 蓝色 添加到正文中,
还有一个删除它的函数hideCongratAndBlueBody()。
My problem 是 i already had a fixed backgroundImage set for my body,因此是 blue color is not showing on calling addbluebody()
how to override the backgroundImage of body and make visible bluecolor and again show backgroundImage when hideCongratAndBlueBody() ia called.
function addBlueBody() {
$('body').addClass('bodyblue');
}
function hideCongratAndBlueBody() {
timeOut = setTimeout(() => {
$('body').removeClass('bodyblue');
}, 4000);
}
.bodyblue {
background: #3da1d1;
color: #fff;
}
body{
background-image:url(nature image.jpg);
}
【问题讨论】:
-
添加
background-image: none;到你的 bodyblue 类 -
@scraaappy 我想在 hideCongratAndBlueBody() 上重新获得 backgroundImage
-
@obsidian-age 是的