js 动态修改css文件的方法
_.find(document.styleSheets[4].cssRules,function(cssRule){
if(cssRule.selectorText&&cssRule.selectorText.indexOf(".navbar-fixed-top2")>-1){
cssRule.style.position="";
cssRule.style.top="0px";
}
if(cssRule.selectorText&&cssRule.selectorText.indexOf("#pageIndi_content,#page1_l1_content,#page_appList")>-1){
cssRule.style.padding="0px";
}
if(cssRule.selectorText&&cssRule.selectorText.indexOf("#page1_index_content")>-1){
cssRule.style.padding="0px";
}
});
循环用的underscore,在使用cssRule不能直接使用下面的代码,否则不会生效
cssRule.style="left:0;position:'';right:0;top:0px;z-index:1031;";
只能使用
cssRule.style.padding="0px";
热门推荐
10 教培生日祝福语简短
11 好友搞笑留言祝福语简短
12 恭喜祝福语回复语句简短
13 毕业离别祝福语简短老师
14 阿姨添孙子祝福语简短
15 企业国庆问候祝福语简短
16 疫情高考父母祝福语简短
17 外出生日祝福语简短
18 女宝宝满月简短祝福语