Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sticky elements that follow you around while scrolling a web page should be banned like the blink tag. Especially in a mobile browser.

I know where the navigation bar is, if I want to use it, I'll scroll back up and touch something on it. If I want to read related articles, I'll scroll down past your piece, which is where that kind of nonsense always is.

But it gets better: you know what's almost always sticky? Those hideous share/"post this to a social networking site" badges! As shown in that screenshot, even Google can't resist that one!

Why are you covering my viewport with everything but the content you want me to read? Are you trying to make me leave? You know I only have so many pixels on my five inch mobile screen, right??



Put this javascript into the URL field of a bookmark (thereby making it a "bookmarklet" [1]) and then select the bookmark [2] on any page that has those sticky elements. Once run, the sticky elements will be gone. Note multi-lines below, but it will all be one line in the URL field.:

    javascript:(function () {                               
      var i,elements=document.querySelectorAll('body *');   
      for (i=0;i<elements.length;i++) {                     
        if (getComputedStyle(elements[i]).position==='fixed' 
            || getComputedStyle(elements[i]).position==='sticky') {
          elements[i].parentNode.removeChild(elements[i]);
        }
      }
    })();
uBlock Origin's custom filters can also be used to delete those sticky elements as well.

[1] https://en.wikipedia.org/wiki/Bookmarklet

[2] on Firefox for Android, 'selecting' the bookmark to run on a page entails touching the URL bar, then selecting the bookmark item into which you placed the javascript from the bookmarks list that will appear.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: