我发现网页上的元素经常被固定在我的方式中。我想找到一种方法来禁用position: fixed
我访问的任何网站中的 CSS 规则。
我编写了一个用户脚本(Firefox,Greasemonkey),它扫描文档中的每个节点并确定它是否有一个固定的计算样式位置,然后将其覆盖为静态。
有没有更好的方法来实现我的目标?
这是我写的脚本,我现在把它缩小到 div:
Array.forEach(
document.querySelectorAll("div")
,function(el) {
if (window.getComputedStyle(el).position === 'fixed') {
el.style.position = 'static';
}
}
);