the image is too small to see what is supposed to be sticky…
Sry about that… thought it might give some reference. Try accessing the shared link if possible. If you’re on mobile,
Here’s a breakdown:
About + Contact (SECTION) - [position:relative]
—> Sticky Div (DIV) - [position:sticky]
------> Overflow Hidden (DIV) - [position:static]
------------> Rest of the children elements are [position:static]
I’m sorry, but I don’t understand what is supposed to be happening.
Ok my bad
So once I scroll down, the ABOUT section is supposed to stick and when I keep scrolling, the CONTACT section reveals. Right now, as I scroll down, it automatically animates, without the section sticking to the top. I don’t want the CONTACT section to reveal before the entire ABOUT section is visible. Hope it’s not confusing.
Here’s a reference for something similar. Instead of pressing the CONTACT section, it has to reveal itself once I scroll down.
In that case it’s not sticking to the right thing… it’ll stick to the nearest parent that is relative…
The parent section(About+Contact) to the STICKY DIV is positioned as relative.
But what’s stoping Scrollabe div from going up the page?
I’m not sure if I understand that correctly.
You need to make it stick to the to of the screen, not keep scrolling too…
Taking the dog for a walk… be back later, hopefully you’ll have figured it out!
Sticky works in such a way that when a child is set to sticky it will stay at a certain position for the duration of it’s parent’s scrolling. Meaning that the parent’s height should be larger than the height of this sticky element and should not be determined by the height of the sticky element. In your case sticky is the div that includes all the content and its parent’s height = sticky element’s height. So where would the stickiness come from?
That makes total sense. And I fixed the animation too. Thankyou!