News for hackers. Stuff that matters.
Re:Is the web getting slower? by achairapart on Wednesday September 09, 2020 @07:57AM (#24420029)
Come on, even the caniuse page you linked says `position:sticky` is supported by 94.33% of browser. For that ~5% left (very old browser versions or specific cases like Opera Mini, most likely even less real cases due to bot noise in statistics) there is a thing called "Graceful Degradation". If you do things right your page won't break at all if that CSS property is not supported. Your header will just be positioned fixed or even static.

So, really, no huge (or small) JavaScript file needed at all in this case. Like most other bloat in web dev, that's just laziness that accumulates.

Re:Is the web getting slower? by thursday0987 on Wednesday September 09, 2020 @09:08AM (#24420589)
94% is actually a really low number for support.

that means that 6 out of every 100 people can't use it.

Roughly 10 million people visit HN every month.

that means that about 600,000 people can't use it just on HN alone.

Re:Is the web getting slower? by achairapart on Wednesday September 09, 2020 @09:18AM (#24420679)
Well, statistics don't work in that linear way. For a start, that 94% is a global percentage that isn't evenly distributed worldwide, let alone on HN...

Anyway in my comment I was actually saying that if you do things right it will work even for that 5%, without any JS. Maybe it wasn't clear enough?

Re:Is the web getting slower? by earthboundkid on Wednesday September 09, 2020 @01:46PM (#24423649)
Flip it around: You're fucking up the browsing experience of 9.4 million people for a minor graphical effect that totally destroys scroll behavior and CPU.

Just use CSS. No one will miss the sticky bar if it doesn't show up on their browser.