我正在<body> tag
使用带有content_script.js
方法的chrome扩展before()
文件之前的每个网页中注入html代码。
我将margin-top:60px;
添加到body标签中。它完美地显示在一些网站的标题部分,但我的问题是一些其他网站标题是坚持。他们使用position:fixed;
css来粘贴标题。我需要知道我们是否可以使用javascript或jQuery识别div包含样式css position:fixed;
。
答案 0 :(得分:1)
获取分配给元素的特定CSS条目的值并进行比较:
p, span etc.
答案 1 :(得分:0)
你可以试试这个: -
var x = $('div').filter(function () {
return this.style.position == 'fixed'
});
现在变量x
包含样式为position:fixed
通过此代码获取ID: -
x.each(function(){
alert($(this).attr('id'));
});