Archived topic
Sticky right sidebar widgets
5 replies · Started by Paul on April 9, 2021
hello, how are you?
I want to put two or more sticky widgets on the right sidebar when scrolling down.
now I have 2 right sidebar widgets and please check my website page in private information
can you guide me on how to fix them?
thanks in advance and best kinds
paul
Hi there,
try adding this CSS:
@media(min-width: 769px) {
.inside-right-sidebar {
position: -webkit-sticky;
position: sticky;
top: 0;
}
}
Hi David,
Thank you very much for your help support.
yes, it is perfect after adding the code you sent me.
one more thing here:
if using the above code, it will be sticky for all right sidebar widgets and now it is for two widgets.
so, if i want to only fix one widget such as the first one, the second one, or the third one, how to adjust the above codes?
i also added my page in the private information.
looking forward to your reply.
thanks in advance
paul
Hi Paul,
In that case, you'll need to remove the above CSS, replace it with the below CSS, the number 1 in nth-child(1)means the first widget, if you change it to 2, then it's targeting the 2nd widget in the right sidebar.
@media (min-width: 769px) {
.inside-right-sidebar >*:nth-child(1) {
position: sticky;
z-index: 200;
top: 60px;
}
.inside-right-sidebar {
height: 100%;
}
}
hello, thanks for your help and they are perfect.
have a nice day and stay healthy.
paul
You are welcome :)
Happy weekend!