Skip to content

Instantly share code, notes, and snippets.

@rofrol
Last active June 6, 2018 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rofrol/a52a36102daf59eeef91c715c0ae402b to your computer and use it in GitHub Desktop.
Save rofrol/a52a36102daf59eeef91c715c0ae402b to your computer and use it in GitHub Desktop.
Fixed to Absolute Important user script
// ==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