Hierarchical Sticky Headings

How can a sticky H2 be "pushed up" by a following sticky H1?
11 Replies
SvenSplynter
SvenSplynter4mo ago
Can you be a bit more specific? Is this when scrolling?
Tobias Sjögren
Tobias Sjögren4mo ago
Sorry, yes, when scrolling
ChooKing
ChooKing4mo ago
I'm not sure if this is what you want. https://codepen.io/chooking/pen/wvZdyvo
Tobias Sjögren
Tobias Sjögren4mo ago
Header level 2 should not push up its parent (level 1)..
SvenSplynter
SvenSplynter4mo ago
@Tobias Sjögren I think this is what you're looking for then. https://codepen.io/Sven-Joseph/pen/JjVJbqj or perhaps a combination of this with what ChooKing was giving you?
Tobias Sjögren
Tobias Sjögren4mo ago
Can you add a H1 below that pushes up both of your H1 and H3 ? Any following equal- or lower-numbered H should push up any previous sticky H (placed above). In ChooKing's example, every H is pushed up by another H regardless of level numbering (H1, H2 etc.)...
SvenSplynter
SvenSplynter4mo ago
I've modified the pen. Please take a look
Tobias Sjögren
Tobias Sjögren4mo ago
That is what I meant! Thx!
SvenSplynter
SvenSplynter4mo ago
The trick is to make the div's that contain the different header levels nested
Tobias Sjögren
Tobias Sjögren4mo ago
Have you seen such a behaviour anywhere ?
SvenSplynter
SvenSplynter4mo ago
It actually looks pretty familiar, but I can't really say where I've seen it before. I guess it reminds me the most of the sticky header in VS Code