- This topic has 15 replies, 4 voices, and was last updated 5 years, 2 months ago by David.
-
AuthorPosts
-
May 3, 2018 at 12:27 pm #566736pz
Look at my site: https://autoinformator.pl/
I want to make primary and secondary navigation sticky together. Now only primary navigation is sticky. I wonder if there’s a way to do it without third party plugins or codes using only GeneratePress funcionality?
May 3, 2018 at 9:14 pm #566963TomLead DeveloperLead DeveloperHi there,
You could try something like this:
.navigation-stick + .secondary-navigation { position: sticky; left: 0; right: 0; top: 50px; }
May 3, 2018 at 10:56 pm #567013pzThank you, however it works only for non-logged-in users. After logging only primary menu is sticky. Why?
May 4, 2018 at 9:14 am #567480TomLead DeveloperLead DeveloperI would have to log in to know 100%. Are any other elements introduced once you log in?
March 2, 2019 at 4:28 pm #826915RodolfoHi Tom,
I was just looking for the same behaviour and found this thread.
It works here, like PZ said… If I’m logged, does not work.
At this moment, it is not a problem (for me)… but it would be better if we can make it works when I’m logged too.Any idea?
Thank you.
Just to you know… I added some extra css to hide shadow effect:
.sticky-enabled .main-navigation.is_stuck
{
box-shadow: none;
}March 2, 2019 at 10:21 pm #827026TomLead DeveloperLead DeveloperAny chance you can send us temporary login info so we can take a look?: https://generatepress.com/contact
Be sure to mention this topic if so 🙂
March 3, 2019 at 4:56 am #827202RodolfoTom, good morning!
I got the problem… “Admin Toolbar”… in this case, top: 50px is not enought to show secondary navigation.
In this case, we should increase about 32px to push secondary navitation …For example:
If not logged:
.navigation-stick + .secondary-navigation {
position: sticky;
left: 0;
right: 0;
top: 50px;
}If logged:
.navigation-stick + .secondary-navigation {
position: sticky;
left: 0;
right: 0;
top: 82px;
}Is there a way to do that?
March 3, 2019 at 5:39 am #827231DavidStaffCustomer SupportHi there,
Wordpress adds the
admin-bar
class to the body when it is in view. So your logged in selector would look like this:.admin-bar .navigation-stick + .secondary-navigation
March 3, 2019 at 6:00 am #827240RodolfoPERFECT! Great!
David, just to know…
The final css would be it? (I mean, should I repeat position, left, right and just adjust top value?)
.navigation-stick + .secondary-navigation { position: sticky; left: 0; right: 0; top:45px; } .admin-bar .navigation-stick + .secondary-navigation { position: sticky; left: 0; right: 0; top:77px; }
March 3, 2019 at 6:01 am #827242DavidStaffCustomer SupportYou only need the properties that are changing. In this case its just the Top property.
March 3, 2019 at 6:35 am #827264RodolfoDone! … thank you!
March 3, 2019 at 6:57 am #827409DavidStaffCustomer SupportYou’re welcome. Glad we could be of help.
March 5, 2019 at 12:19 pm #829855RodolfoHey again! …
It is working, but I just created another problem here…
I use anchor links and smooth-scroll class. So, when I click a link, H2 heading is hiddens, in back of second navigation area…
Is there a way to fix it too?
URL: http://www.computar.com.br – For example, in main menu, just select “SOLUÇÕES” menu and you will see it…
Thank you.
March 5, 2019 at 1:57 pm #829916DavidStaffCustomer SupportThe simplest way would be to use some CSS to add some padding to the H2 elements.
Currently there is 86px top margin so you could split this between margin and padding e.g.h2 { margin-top: 45px; padding-top: 40px; }
March 5, 2019 at 3:37 pm #829989RodolfoPerfect! … Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.