- This topic has 13 replies, 3 voices, and was last updated 5 years, 2 months ago by
David.
-
AuthorPosts
-
March 24, 2021 at 4:56 pm #1708729
Braden
Hey there! I’m trying to do a couple different things with the navigation for a website I’m working on:
On desktop, I’d like Primary Navigation (buttons, aligned left) and secondary navigation (icon images, aligned right) to exist on the same line, below the header image. I’d also like the icon images to be vertically centered within their buttons – they seem to be attaching themselves to the top of the button unlike the text.
On mobile, I’d like to do the same thing, but would like the secondary menu’s buttons to just be visible at all times without a hamburger or off-canvas menu.
Is there an easy way to do this that I’ve just been missing? I’d also prefer not to use extra plugins if possible – trying to keep the site as lightweight as possible. Thanks in advance for the help!
March 24, 2021 at 6:47 pm #1708771Elvin
StaffCustomer SupportHi there,
Let’s break things down.
As for the desktop menus in general:
I’m not fully sure I understand the exact layout you want to do. Any chance you could provide a mockup image for us to have a better idea on how to approach this?As for the secondary menu on mobile:
To disable the hamburger for the secondary nav, try this:
https://docs.generatepress.com/article/disable-secondary-navigation-mobile-menu/As for vertical alignment of icons:
The icons can be vertically centered with CSS.Can you link us to the page in question so we could check it to be able to provide the proper writeup for CSS?
Let us know.
March 24, 2021 at 7:40 pm #1708793Braden
Sure. go over to https://assortedmeeples.com on desktop. You can see the primary menu currently. The secondary menu (currently not displayed) will contain the social media buttons that are presently visible to the right immediately under the menu – I’d like those buttons to appear on the same line as the primary menu on both desktop and mobile views.
March 24, 2021 at 11:37 pm #1708901Elvin
StaffCustomer SupportTo clarify, I believe you’re aiming for something like this?
If so, first we move the secondary navigation.
Check this article on how to move the placing of the secondary navigation. Pick “Below Header”
https://docs.generatepress.com/article/secondary-navigation-location/You then create a menu you can specifically assign to the secondary navigation, this will hold your icon menu.
On the secondary navigation, you should be able to set the icons navigation alignment like this:
https://share.getcloudapp.com/nOuoEENgMarch 25, 2021 at 7:21 am #1709582Braden
Unfortunately, I can’t see your example. As to the two links you supplied, I know how to perform those steps, but when I do that, it places the secondary menu (and its icons) on a second line below the primary navigation. I do not want that – I want them to exist on the same line instead.
March 25, 2021 at 8:36 am #1709666David
StaffCustomer SupportHi there,
do you have a link to your site where we can see the current setup ?
March 25, 2021 at 10:46 am #1709821Braden
Sure do: https://assortedmeeples.com
Secondary navigation is currently disabled.
March 25, 2021 at 5:04 pm #1710079Elvin
StaffCustomer SupportAh, my bad. It was this example:
https://share.getcloudapp.com/llu5mrq6If you want them to be on the exact same line then perhaps there’s no reason to use secondary navigation.
You can simply add the social icons on the same menu and set them apart as required with CSS.
If you can perhaps add the mock-up image of how you want it laid out, we can help out with the CSS write up.
March 25, 2021 at 9:18 pm #1710178Braden
That example isn’t doing what I want either. Here’s a couple mockups for desktop and mobile.
https://drive.google.com/file/d/15G2ySHhZb4R_d855YgCUuQudBfmH_aIN/view?usp=sharing
https://drive.google.com/file/d/1aCqsN7gm4f7o7uNxh3qVWypYZ78NYRK5/view?usp=sharing
Hopefully this does a better job of conveying what I’m looking for.
March 26, 2021 at 4:05 am #1710467David
StaffCustomer SupportSo to add the Icons into the Primary Navigation.
You can use a Hook Element.1. First you need to change the Customizer > General > Structure to Flexbox. This version adds the
menu_bar_itemshook
2. Add a new Hook Element:https://docs.generatepress.com/article/hooks-element-overview/
Add your icon HTML to the hook content.
Set the Hook to:generate_menu_bar_items
Set the Display Rules to Entire site.It will need some CSS to position them. If you want to set that up, i can help with the CSS
March 26, 2021 at 2:10 pm #1711282Braden
All right, we’re getting somewhere now! I’ve got the images added to the menu and have reduced their height to 32px through CSS. Now we just need to get the buttons closer together and centered on the right side on Desktop and Mobile, plus making sure the icons stay on the same line as the hamburger menu in Mobile. Any help you can provide with the CSS for that is appreciated!
March 27, 2021 at 3:10 am #1711682David
StaffCustomer SupportTry this CSS:
.main-navigation .inside-navigation .menu-bar-item>a { padding-left: 8px; padding-right: 8px; } .menu-bar-item img { height: 32px; vertical-align: middle; }March 27, 2021 at 8:16 am #1712162Braden
Those were the missing pieces I needed. I added in padding-bottom: 2px; to the .menu-bar-item img as the vertical align wasn’t quite centered, and things are looking good now. Thanks so much for your help!
March 27, 2021 at 2:55 pm #1712418David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.