I want to recreate something like the about section of this amazing portfolio: https://www.david-hckh.com/
There in the about section the section appears to be 100vh and has a side content with about info that scrolls in the main scroll and when it is over then the section scrolls and continues with the rest of the sections.
I believe, but I’m not sure, that he is using ScrollControls from react three drei but with that wrapper we can’t have pages that have a height greater than 100vh so I want to implement something like what he did in my react app.
I tried setting the min-height to 100vh and for that specific section that is longer than 100vh create an overflow scroll but it doesn’t do anything.
2
Answers
vh can cause issues with address autohide in mobile browsers.You can use maybe dvh but some versions of browsers doesn’t support it.
Link you shared is is heavily scroll controlled.You can maybe try same way too.
i hope it helps
Unless you really need all the extra bells and whistles of that site, the basic effect is actually easy to achieve with just CSS using
position: sticky;
. What you want is to have a section that scrolls naturally and is taller than the viewport, with some element that becomes "stuck" to the page while that section is in view. You have 3 elements:In the example site you gave, A is the section, B is the stats/content on the left, and C is the background render of David.
You want your container (A) to naturally be the height of the content (B), but no smaller than the viewport height:
For the "fixed" content (C), use sticky positioning and whatever other styles you need to place it correctly.