Skip to content

Instantly share code, notes, and snippets.

@kymokleo
Created May 17, 2024 06:42
Show Gist options
  • Save kymokleo/5b9aaccd987adac9e761b60a6c2f1a75 to your computer and use it in GitHub Desktop.
Save kymokleo/5b9aaccd987adac9e761b60a6c2f1a75 to your computer and use it in GitHub Desktop.
Run as a bookmarklet to remove annoying sticky elements on webpages, such as cookie notifications and floating widgets.
const killStickyElements = () => {
document.querySelectorAll("body *").forEach(function (node) {
if (["fixed", "sticky"].includes(getComputedStyle(node).position)) {
node.parentNode.removeChild(node);
}
});
document.querySelectorAll("html *").forEach(function (node) {
var s = getComputedStyle(node);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment