js 动态修改css文件的方法
作者:bea
_.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 &
_.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";
猜你喜欢
您可能感兴趣的文章:
- JSON.stringify转换JSON时日期时间不准确的解决方法
- js事件监听机制(事件捕获)总结
- 使用jquery.qrcode生成彩色二维码实例
- 兼容最新firefox、chrome和IE的javascript图片预览实现代码
- js调试工具console.log()方法查看js代码的执行情况
- JS创建类和对象的两种不同方式
- 将HTML格式的String转化为HTMLElement的实现方法
- jquery datatable后台封装数据示例代码
- jquery对象和javascript对象即DOM对象相互转换
- js判断当页面无法回退时关闭网页否则就history.go(-1)
- js和jquery设置disabled属性为true使按钮失效
- javascript中为某个元素指定事件的三种方式
- 谷歌地图打不开的解决办法
- JavaScript验证18位身份证号码最后一位正确性的实现代码
- jquery bind(click)传参让列表中每行绑定一个事件
- jQuery html()方法使用不了无法显示内容的问题
- JQuery设置获取下拉菜单某个选项的值(比较全)
- js触发select onchange事件的小技巧
- jquery中each遍历对象和数组示例