Last active
September 8, 2020 07:51
-
-
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
This file contains hidden or 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
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); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What would I do without you, @jlowgren? 😉