4 ms·
OT: I'm not a front end guy, so maybe this is a dumb question, but why do so many sites with some kind of floating header mess up page at a time scrolling? By
by tzs 9y ago
OT: I'm not a front end guy, so maybe this is a dumb question, but why do so many sites with some kind of floating header mess up page at a time scrolling?
By "floating header" I mean that thing at the top on the story site that has the story title, the link to comments, a read later link, and a share link, that stays in a fixed position in the window as you scroll the story.
When you scroll the site (Firefox, Chrome, Safari) by hitting the space bar, it scrolls an amount appropriate for what would be visible if the floating header were not there. What this means is that the first line or two that are invisible before the scroll, because they are below the bottom of the window, end up at the top of the window, under the floating header.
Is there no way in CSS or something to set the size of the viewport that the scrolled content is shown in, so that the browser can scroll the appropriate amount? Or do you have to take over scrolling yourself in JavaScript to make that work, which then tends to result in scrolling that does not quite match native scrolling and so annoys people?
If the latter, couldn't you leave scrolling alone when done via the mouse wheel or clicking in the scroll bar, but intercept keyboard events and handle space processing yourself, so that you ONLY take over that form of scrolling? That would be a big improvement over the current situation.
- greeneggs 9y agoThis drives me mad, too. The NY Times does space-bar scrolling right. Random example: https://www.nytimes.com/2017/11/23/opinion/immigration-visa-h1b-trump-.html https://www.nytimes.com/2017/11/23/opinion/immigration-visa-...