- This topic has 10 replies, 3 voices, and was last updated 3 years, 1 month ago by Leo.
-
AuthorPosts
-
March 7, 2021 at 8:17 am #1685622Sean
Hi, I have GP Pro and I can’t figure out how to make the Header and horizontal navigation bar below it stay “sticky” during scrolling. I was able to find the check box for making the nav bar sticky, but not both. I’ve searched through the forums and on google and it seems like the only option is knowing how to write the proper code in CSS (I think? I don’t know anything about that.) or getting a paid plugin that lets me make both items sticky. Any help is greatly appreciated!
March 7, 2021 at 8:43 am #1685660LeoStaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can use the private information field.
Let me know π
March 7, 2021 at 8:49 am #1685666SeanI’m not sure. I’m building the site on a temporary sub domain. I’ll post the link below.
March 7, 2021 at 11:27 am #1685784LeoStaffCustomer SupportAre you hoping to make this entire part sticky in this layout?
https://www.screencast.com/t/mCtDPyuUT9CzHave you considered uploading your icon as the sticky navigation logo?
https://docs.generatepress.com/article/sticky-navigation/#sticky-navigation-logoI think that would be a good option as well.
Let me know π
March 7, 2021 at 11:37 am #1685792SeanYes, I would like that section to remain as people scroll. I tried putting the logo as the background image for the navigation bar, but it didn’t look good at all. The nav buttons were in the middle of the image and the image didn’t fit right.
March 7, 2021 at 11:58 am #1685821LeoStaffCustomer SupportTurn off the sticky navigation option in the customizer:
https://docs.generatepress.com/article/sticky-navigation/And try this CSS:
@media (min-width: 769px) { .site-header { position: sticky; top: 0; z-index: 99; } .main-navigation { position: sticky; top: 130px; /*ADJUST THIS NUMBER = TOTAL HEADER HEIGHT*/ z-index: 99; } }
Adding CSS: https://docs.generatepress.com/article/adding-css/
March 7, 2021 at 12:15 pm #1685840SeanHi Leo, it looks like the one I tried was different from what you suggested (on the sticky navigation). That way actually works nicely. Not exactly what I was aiming for, but it might be better.
The only problem is that when you start scrolling and the logo appears to the left, with the menu to the right, the logo has a lot of unnecessary padding above and below the logo, making it thinner and harder to read. Is this adjustable?
Thanks for pointing that out!
March 7, 2021 at 4:32 pm #1685999YingStaffCustomer SupportHi Sean,
You could give this CSS a try:
.sticky-navigation-logo img { padding: 0; } #sticky-navigation .navigation-branding { margin-left: 0; }
March 8, 2021 at 4:46 am #1686456SeanHi Ying, I will try that, thank you!
Regarding the earlier idea, is this a good way to do it?
https://generatepress.com/forums/topic/sticky-header-7/Thanks!
March 8, 2021 at 4:55 am #1686461SeanLeo, your suggestion to use a logo on the Nav bar was not what I had in mind, but it turns out to be a better solution because it gives more screen space on a PC and especially on a phone. Also, when using a phone, the menu is already collapsed, so instead of a mostly empty bar, the logo fills in the space nicely.
Thanks!Ying, your code did the trick perfectly! Now the logo fills the space and is much easier to read. Thank you!
March 8, 2021 at 4:59 pm #1687404LeoStaffCustomer SupportGlad we could help π
-
AuthorPosts
- You must be logged in to reply to this topic.