I’d like the bar to scroll until it’s about 200 px. away from the top of the browser window, then become fixed, then start scrolling out of view when the next section scrolls into view.
Something like this: Dang, Tokyo Cabbies Sure Know How to Power Nap | WIRED
I can’t figure out how to do this with interactions so I think it might have to be done with code…
Can anyone help me? @bart?..
All you’ll need to do is add the necessary script (its on the front page of the sticky js page) into the custom footer code section. Just remember to change the “#sticker” declaration to whatever ID you give your social bar in webflow!
Hi @EvanJones
I don’t know any jQuery or JavaScript! I checked the second option, copied and pasted the code in the footer section, changed the id and the pixel value but it’s not working… I’m probably missing something…
Also, I noticed there’s an option to unstick the object. Where should I put this snippet and how can I style it so that the social bar unsticks when the next section scrolls in?
Can you check my website and help me?
Thank you
Firstly, you put “socialbar” in the script: it actually needs to be “#socialbar” as below, so that jQuery knows its looking for a Div ID:
The sticky code won’t work in the webflow preview, so you’ll have to publish your changes & check out the live site to see whether its now functioning.
I’ll have a read about the unstick property on GitHub tonight & see if I can write a few lines of code for you for this too
Its changing the size because at present you have the DIV inside a column, which is constraining its width. As soon as it becomes fixed it’s removed from the column and will expand a little. Easy enough to fix though
First move it out of the column its in as below:
Then you’ll need to change the size & positioning of the DIV so that it sites on the right of the page. Here’s a rough guide:
Float: right Position: relative Margin-right: 50px (or there abouts, play with it till you’re happy) Width: i used 260px, but use whatever works best for you
Play around with the position settings until you’re happy with here it sits on the screen & all should be good. Personally I like social bars that are right against the right or left side of the screen, but i’ll leave that up to you!
Hi @EvanJones, thanks
It’s almost there!
I changed some values in your code to make the transition smoother but it’s still a bit “jumpy” on the Ipad. Is there a fix for this?
Did you figure out how to unstick the bar when the next section scrolls in?
Thank you so much!