A simple (I think) parallax question

Hi all,

I am am tryting to achieve a simple parallex feature, but I am wanting one particular action which I thought would be simple but for the life of me I can’t think of the way to make it happen! I would an image within a hero section to parallax vertically slower (in this case around 300%), but I would like the image to exit the screen in effect along with the section, so for parallax to occur but the element then continue to scroll out of screen at normal pace in, in effect to stay within the section. The perfect emaple is here Experience | Mammut . The parallex only lasts for a small % of scroll, then the element leaves the screen at usual scroll rate.

I think the answer is really simple? But my brain doesn’t seem to want to help me out.

Thanks in advance

1 Like

Can you share a link maybe?

Thanks for the reply Ivo.

The link to the Mammutt site is the perfect example, the action on the hero section is exactly what I’m wanting to achieve, Experience | Mammut

Thanks in advance

1 Like

There are a few things happening at the same time inside that hero section. I built a small CodePen that breaks it down (With some help from Claude.):

https://codepen.io/ivojerkovic/pen/wBoaxep

The trick is a sticky-pinned container with a subtle internal parallax on the image, plus a text block that sits after it in the DOM and scrolls up over it. The “image leaving with the section” comes for free from position: sticky releasing at the right moment.

Hope it helps you spot what’s missing in your setup.

Hi Ivo, very very helpful info, thank you very much for taking the time to do that, it has helped me create what I need. What I was missing was the knowledge that am element stuck to the top will move up and out of frame along with the bottom of it’s parent, if I’m understanding that correct?

Also, how did you use to go about analysing a page, just using webtools inspector?

Many thanks,

1 Like

That’s correct, sticky moves with the parent while fixed stays fixed to position in the viewport. Here is a quick explanation: CSS Position Sticky vs CSS Position Fixed | BrowserStack

I used inspect/dev tools and claude (copied the full section to claude to clean it up and simplify so it’s easier to read)