- This topic has 13 replies, 2 voices, and was last updated 6 months, 2 weeks ago by
David.
-
AuthorPosts
-
September 9, 2022 at 5:40 am #2337916
Petri
Hi Support,
I’m struggling with the sticky navigation, the width of the header is contained, this works OK, however when I scroll down the sticky navigation becomes full-width and pops out of the container.
Thanks in advance.
September 9, 2022 at 6:46 am #2337978David
StaffCustomer SupportHi there,
1. go to Customizer > Layout > Primary Navigation
2. temporarily change the Navigation Location toBelow Header
3. set the Inner Navigation Width toContained
4. switch your Navigation Location back to float right.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 9, 2022 at 7:28 am #2338021Petri
Hi David,
I followed the steps, unfortunately the sticky navigation stays to wide.
September 9, 2022 at 8:05 am #2338200David
StaffCustomer SupportTry again with this amend
3. set the Navigation and Inner Navigation Width to Contained
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 9, 2022 at 8:20 am #2338213Petri
This amend also doesn’t help.
September 9, 2022 at 8:33 am #2338232David
StaffCustomer SupportThe inner container seems to be working:
Do you want the areas i marked in red to be removed ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 9, 2022 at 8:35 am #2338237Petri
Yes, that’s what I have in mind thanks.
September 9, 2022 at 8:49 am #2338256David
StaffCustomer SupportHmmm… odd one, that should work, try adding this CSS:
.sticky-enabled .main-navigation.is_stuck { max-width: 1300px; margin: auto; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 9, 2022 at 9:38 am #2338302Petri
Hi David,
Thanks again for your help, it now works on larger screens, however on smaller screens the sticky-navigation is still wider than de page-hero photo.
I think this is because I have this code for the body for the looks/design:body {
padding-left: 25px;
padding-right: 25px;
background-color: #f5f5f5;
}Is there also a way to solve the sticky nav. problem this while keeping this css-code or am I obliged to delete it?
September 9, 2022 at 9:51 am #2338308David
StaffCustomer SupportSo keep the CSS i gave you above add this CSS now:
@media(max-width: 1350px) { .sticky-enabled .main-navigation.is_stuck { max-width: calc(100vw - 50px) !important; } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 9, 2022 at 11:23 am #2338362Petri
Thanks David, that does the trick!
September 10, 2022 at 4:06 am #2338766David
StaffCustomer SupportAwesome – glad to hear that!!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 10, 2022 at 6:00 am #2338833Petri
Hi again David,
One more remark sorry, after all it didn’t work perfectly because the width was different on different browsers/screens.
So I found another solution: I just turned sticky navigation off in the Customizer and made the header sticky directly in Simple CSS by adding:
.site-header {
position: sticky;
top: 0;
}
This works on all browsers/screens and also saves me quite some extra css code ๐
Have a nice weekend!September 10, 2022 at 7:11 am #2338884David
StaffCustomer SupportGlad to hear you found a better solution ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.