Skip to content

Instantly share code, notes, and snippets.

@jodelamo
Forked from frippz/unSticky.js
Last active September 23, 2019 12:51
Show Gist options
  • Save jodelamo/5376ed5449c0093af7d25ac56c7134d6 to your computer and use it in GitHub Desktop.
Save jodelamo/5376ed5449c0093af7d25ac56c7134d6 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 body = document.querySelector('body');
if (getComputedStyle(body).overflow === 'hidden') {
body.style.overflow = "unset";
}
elements.forEach((element) => {
if (['-webkit-sticky', 'sticky'].includes(getComputedStyle(element).position)) {
element.style.position = 'unset';
}
else if (getComputedStyle(element).position === 'fixed') {
element.parentNode.removeChild(element);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment