Skip to content

Instantly share code, notes, and snippets.

@frippz
Last active September 8, 2020 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save frippz/7f9d008f386f55829967cce7609f5969 to your computer and use it in GitHub Desktop.
Save frippz/7f9d008f386f55829967cce7609f5969 to your computer and use it in GitHub Desktop.
Un-sticky toolbars and kill fixed elements bookmarklet, and possibly re-enable scrolling of the page
const elements = document.querySelectorAll('body *');
const containers = document.querySelectorAll('html, body');
containers.forEach(el => {
if (getComputedStyle(el).overflow === 'hidden') {
el.style.setProperty ('overflow', 'unset', 'important');
}
});
elements.forEach(function (element) {
if (["-webkit-sticky", "sticky"].includes(getComputedStyle(element).position)) {
element.style.position = "unset";
}
else if(["fixed"].includes(getComputedStyle(element).position)) {
element.parentNode.removeChild(element);
}
});
@frippz
Copy link
Author

frippz commented Sep 8, 2020

What would I do without you, @jlowgren? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment