I am frequently finding that elements on web pages are causing disruptions due to their fixed positioning. I am exploring ways to disable the position: fixed
CSS rules on any website I visit.
To address this issue, I have developed a userscript specifically for Firefox with Greasemonkey. The script scans each node within the document and evaluates if it has a computed style of position fixed, and then overrides it to static.
While my current approach works for divs, I wonder if there is a more efficient way to achieve my objective?
Below is the snippet of code I have developed:
Array.forEach(
document.querySelectorAll("div")
,function(el) {
if (window.getComputedStyle(el).position === 'fixed') {
el.style.position = 'static';
}
}
);