Have you ever been on a website where an element “sticks” to the screen and follows you as you scroll down the page? This is what I call a sticky s...
For further actions, you may consider blocking this person and/or reporting abuse
Nice post! Is there any reason that you couldn't do this with the more widely-supported
position: fixed
?"Fixed" is always fixed to the window coordinates, while "sticky" is displaying similar behavior like elements made with javascript. Solving this UI problem with CSS is always a better solution when it comes to UI performance.
Here is an example I found online: codepen.io/nyctophiliac/pen/xpmpyp
Worldwide adoption is 86%, so we may start to use it.
caniuse.com/#search=position%3Asticky
As always, only retarded Microsoft browsers are problematic.
I understand the difference, however in the example the sidebar starts at the top anyway so there is no difference.
Make window smaller and scroll up and down, so you will notice where is the difference.
This helped, Thanks!
correction on my last post, which I don't see now so not sure if it was sent.
I removed the width components on sidebar and main with no change on functionality, not the height. I changed the main height to 100vh for my scenario and its works fine, but the sidebar height has to be at least 150vh in order for this to work.
What if I want the opposite? I want it to scroll first and then go sticky so if you have a menu and a LOOONG post people can get to the bottom of the menu before scrolling all the way to the bottom of the post.
Hello @biamorton , did you ever solve this?
I found this article by googling sticky sidebar. This super super helpful and to the point. Thank you so much!
Hello @claire Parker-Jones
How can i develop Side note for my wordpress website i want to display side note on my Post page with Sticky way. where my users can directly go to the desired topic on a post
for example check this site website: wp.me/aZ4zD
i want to implement on my affiliate website where my users can directly to product page instead of reading entire guide
Thanks
And how would you do it if theres several elements where each of them have their own contents that they have to 'stick to' ?
What of applying this in WordPress? Would it work on my theme. I think what should be replaced are the class names or sth.
Days ago, I stumbled to get this to work but all to no avail. Thankfully, I now have a lifting content.
Let me see how it goes
Does it work in Firefox?
thank you!
Wow, thats easy.
Thanks!
Nice post Claire.. Is there any IE11 supported feature too or a fallback for IE11?
This worked great on rails 5.2 with bootstrap 4 installed. I removed the height components for the sidebar and main page with no impact on functionality. Awesome post, thank you.
thanks this really helped me after all struggles
I remember last year wishing there was more support for position:sticky. Glad to see it has improved across the major browsers, I will definitely be using this from here on out!
how can I get sticky specific sidebar just when scrolling?
Anyway the position:sticky; dones't work at all
Any update on this? I can't get mine to work on WordPress
Awesome! Thanks so much!
IE 11 is not supported well.
Thank you buddy! you saved my day!