Last active
June 6, 2018 10:53
-
-
Save rofrol/a52a36102daf59eeef91c715c0ae402b to your computer and use it in GitHub Desktop.
Fixed to Absolute Important user script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fixed to Absolute Important | |
// @namespace https://greasyfork.org/en/scripts/369282-fixed-to-absolute-important | |
// @description Stops elements from following you as you scroll down the page | |
// @version 1 | |
// ==/UserScript== | |
// https://gist.github.com/rofrol/a52a36102daf59eeef91c715c0ae402b | |
// Based on https://alisdair.mcdiarmid.org/kill-sticky-headers/ | |
var i, elements = document.querySelectorAll('body *'); | |
for (i = 0; i < elements.length; i++) { | |
if (getComputedStyle(elements[i]).position.startsWith('fixed')) { | |
elements[i].style.setProperty("position", "absolute", "important"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment