- This topic has 14 replies, 2 voices, and was last updated 4 years, 6 months ago by
David.
-
AuthorPosts
-
March 3, 2021 at 12:06 am #1679797
Sunil
Dear Team
Is there a way to develop a sticky sidebar similar to Forbes? Their website makes a widget sticky till the middle of the content then another sticky widget takes over till the bottom. Is this possible on generatepress?
March 3, 2021 at 2:02 am #1679913David
StaffCustomer SupportHi there,
that would require custom development – the forbes site is using JS to calculate the height of the content, the relative placement of each sticky element, when it should be sticky and when it should be unstuck as the new element enters the screen.
At the most i can offer is a simple CSS method. This applies to the Right Sidebar of a default install of GP:
@media(min-width: 769px) { .inside-right-sidebar { height: 100%; display: flex; flex-direction: column; } .inside-right-sidebar aside { margin-bottom: auto !important; position: -webkit-sticky; position: sticky; top: 60px; } }
It will simply evenly space out each of the widgets in the sidebar. And makes them sticky.
What it cannot do is remove the sticky position from the preceding element, so as each widget scrolls to its sticky position it will sit in front of the previous sticky element, so each widget would need to be the same height ( or incrementally greater in height ) to stop the previous one from showing behind.Removing the sticky would require some custom JS.
March 3, 2021 at 2:47 am #1679963Sunil
Dear David
Thank you so much for this CSS. It solves 80% of my issue. However, the ads might have a viewability issue if not made un-sticky. Can you share a basic js code that I can edit according to my own website?
It’ll be great if you can.
(Does generatepress has a donate option? You guys solve almost all of my problems. It’s a blessing for me as a non-tech person)
March 3, 2021 at 3:13 am #1679985Sunil
If you can’t help me with that, I see another generatepress website using a similar structure. Maybe you can guide me with how they use it. Attaching the link as well.
March 3, 2021 at 3:20 am #1679993David
StaffCustomer SupportThere may be a pure CSS method i can try if its only applied to the Feedo widgets as their markup is the same and they have no Widget Title… if you can remove the CSS i provided and the Sticky plugin as thats not required and just gonna cause some issues.
We do have a Donate option – Coffee is always appreciated 🙂
https://generatepress.com/ongoing-development/
That other site is actually using Genesis and that advert is a custom JS wrapper purely for the adverts – looks like is built upon the WP Quads Pro scripts – which has been re-incarnated in this plugin but i don’t see any sticky option:
March 3, 2021 at 3:27 am #1680001Sunil
Yes, It’s only for feedo
I’ve removed the CSS and the plugin for now. Thank you so much.
March 3, 2021 at 4:07 am #1680042David
StaffCustomer SupportLets give this a go – if it works ill be super amazed 🙂
@media(min-width: 769px) { .inside-right-sidebar { height: 100%; display: flex; flex-direction: column; justify-content: space-between; } .inside-right-sidebar .feedo-widget { flex-grow: 1; overflow: unset; } .inside-right-sidebar .feedo-widget>div { position: sticky; position: -webkit-sticky; top: 60px; } }
March 3, 2021 at 4:44 am #1680064Sunil
It loves like a charm. You are a genius.
Just one correction needed. The ad hides the overlay video ad. Screenshot here
Can something be done about it?
March 3, 2021 at 5:03 am #1680098Sunil
Found a solution for that as well.
Thanks team!
You guys are amazing!March 3, 2021 at 5:12 am #1680107David
StaffCustomer SupportThats awesome! Glad to be of help 🙂
March 3, 2021 at 5:15 am #1680116Sunil
Hey David
I found just one tiny problem with this. It’s the sidebars on smaller screens (like on my Chromebook). The ads and sidebars cover the content in such cases. How can we fix it?
Can we hide one sidebar? Or I can go away with both of them if that works.
March 3, 2021 at 5:53 am #1680169Sunil
Fixed it as well. Used this code –
@media (max-width: 1100px) { .site-content .content-area { width: 70%; } #right-sidebar { width: 30%; } #left-sidebar { display: none; } }
March 3, 2021 at 5:54 am #1680171David
StaffCustomer SupportThe issue is there just isn’t room for those size adverts in the narrow sidebars.
You can use some CSS like this to remove the left sidebar on smaller screens and fix the width of the right sidebar:@media (min-width: 769px) and (max-width: 1200px) { .both-sidebars #primary { width: calc(100% - 350px); left: 0; } .both-sidebars #right-sidebar { width: 350px; } .both-sidebars #left-sidebar { display: none; } }
March 3, 2021 at 6:31 am #1680220Sunil
Everything is sorted now. Thank you so much!
March 3, 2021 at 7:10 am #1680458David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.