Kill Sticky Headers

2018-08-24

Tired of web-pages that add a bunch of junk content that doesn’t go away when you scroll?

Example

Drag this little emoji skull link to your browser’s toolbar (or bookmark the link on your phone):

☠️

Then click it to remove those elements.

I actually have no idea how to add this bookmark in iOS! I have my bookmarks synced from my laptop. I suspect it’s possible, but you’re on your own 😖 Get in touch if you can find a way that doesn’t involve performing a 19th century Russian Ballet.

Credits

This is a slightly tweaked and improved version of this kill sticky headers” bookmarklet. I changed it to support more kinds of sticky elements and to use a more modern javascript API.

What Does it Do?

Runs the following code:

var i, elements = document.querySelectorAll('body *');
for (i = 0; i < elements.length; i++) {
    var s = getComputedStyle(elements[i]).position;
    if (s === 'fixed' || s === 'sticky') {
        elements[i].remove();
    }
}