【发布时间】:2021-03-09 05:48:12
【问题描述】:
我添加了带有insertRule 的CSS。现在我想在 1 秒后删除属性 background,使其保持之前的状态(由 Bootstrap 设置)。
const css = window.document.styleSheets[0];
css.insertRule(`
.mt-preview .panel-heading {
background: yellowgreen !important;
color: #fff !important;
transition: all 0.75s;
}
`, css.cssRules.length);
setTimeout(() => {
document.querySelector('.mt-preview .panel-heading').style.removeProperty('background');
}, 1000);
我使用了removeProperty(),但这似乎不起作用。如何删除该属性?
【问题讨论】:
标签: javascript twitter-bootstrap twitter-bootstrap-3