Archived topic
Elements Right Sidebar
9 replies · Started by David on February 17, 2021
Hey GP,
I could not get this css to work:
https://generatepress.com/forums/topic/how-make-a-block-which-replace-right-sidebar-to-stay-sticky-on-scroll/#post-1389742
So, I found this using Chrome inspect:
Hi David,
Did you forget to attach the screenshot :)
Could you link us to the site in question using private info field?
Thanks!
The inline style is style = height auto !important in the class inside-right-sidebar
Hi David,
I don't see the CSS height: auto!important;in your site, and even I deleted the !important from the CSS height:100% !important;, the block is still sticky:)
https://www.screencast.com/t/xrMiNVzn89N
Have you sort it out yourself already?
Can you see it now?
Hi there,
The inline style you see is being added by a script. It's messing up with the position: sticky CSS.
Can you try disabling all plugins go one by one to find the culprit? Let us know.
It was not the plugins. I checked them by one. It is google Adsense. When I remove the ads from the page the inline style is no longer present.
Hi David,
Give this CSS a try:
.inside-right-sidebar > .gb-container {
display: flex;
height: 100%;
}
Let me know :)
Here is the css I use (and it works)
/* Sticky */
@media(min-width: 768px) {
.right-sidebar .site-content {
display: flex;
}
.inside-right-sidebar {
height: 100%!important;
}
.sticky-block {
position: -webkit-sticky;
position: sticky;
top: 60px;
}
.inside-right-sidebar > .gb-container {
display: flex;
height: 100%!important;
}
}
/* Sticky */
as long as I do not place ads in the sidebar.
As long as it works :)