Streaming live at 10am (PST)

Help with position: fixed


#1

Hey guys. I've got a div that I've put as fixed as I want it to follow the user down as he scrolls. But then when the user reaches a certain point, an anchor for example, I want the div to either disappear or just stop following.

Basically: Is it possible to give change a div from position: fixed into some else as the user reaches an anchor on the page?

Thanks in advance!
Joakim


Fixed sidebar menu on scroll?
#2

No, but with interactions you can get the same effect.

You need 2 identical elements (you can make their content a symbol so they're in sync), one that will have the first behavior and the other the second. The first one will be visible and the second invisible, and with an interaction, at the precise moment they're at the same position, you'll swap the visibility. That's how we do when we have a navbar floating then sticking to the top of the screen. When well executed, it's not noticeable.


#3

Ah of course. I'll just put the interaction on the section and point it to affect the fixed element using the scroll trigger. Sounds easy enough. Thanks!


#4

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.