- This topic has 18 replies, 3 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
February 26, 2023 at 9:14 am #2547595
Dax
Hi,
I am trying to create a sticky mobile menu that includes a CTA button aligned right of the menu.
In this case I would also need the burger menu to be positioned to the left of the site logo and everything to be aligned and look good on mobile.
Right now I am having trouble figuring this out.
So far, I have added the button and CSS to hide on desktop, but it seems to be hiding it on mobile too?
Any help would be appreciated.
February 26, 2023 at 10:32 am #2547673David
StaffCustomer SupportHi there,
1. Add your CTA Button using a Block Element:
https://docs.generatepress.com/article/block-element-hook/
1.1 Use the
menu_bar_itemshook.
1.2 Set the Display Rules toEntire Site1.3 Use a GenerateBlocks Button block, as it has more styling controls, and in Advanced > Additional CSS Class(es) add:
hide-on-desktop hide-on-tablet cta-buttonto remove it from those screen sizes.Once thats done, let me know and ill take a look at the CSS to make the layout changes you want.
February 26, 2023 at 10:46 am #2547685Dax
All done!
February 26, 2023 at 1:41 pm #2547806Dax
Hey, added all the code, how do I finesse it?
February 26, 2023 at 5:54 pm #2547945Ying
StaffCustomer SupportHi Dax,
Are you adding the button block into a WP column block?
If so, can you make sure there’s only this GB button block in the block element as the column block makes the alignment difficult?
Let me know!
February 26, 2023 at 7:58 pm #2548025Dax
Hey,
I’m slightly confused….do you mean have the button in a single column? It allows me to place it in a group or column?
February 26, 2023 at 8:10 pm #2548029Dax
Hi again,
I think I’ve removed the columns now, but still seems misaligned on mobile? Is there some code to add?
PS also how do I make the font white and not black?
Thank you
February 27, 2023 at 5:37 am #2548475David
StaffCustomer SupportWhere do i see this ?
February 27, 2023 at 6:28 am #2548541Dax
Hi,
Please see link attached.
It’s on mobile version only.
February 27, 2023 at 8:56 am #2548861David
StaffCustomer SupportTry this CSS to position the menu to the left:
.main-navigation .menu-toggle { order: -1 !important; margin-left: 10px; } .main-navigation .cta-button { margin-right: 10px; }The button, as its a GB Button you can style that in the editor
February 27, 2023 at 9:12 am #2548882Dax
That worked perfectly, thank you.
And how can I change the colour of the text? I’m changing it in the button editor making the text white, but it appears black on the front end – I’m confused.
I must be missing something?
February 27, 2023 at 11:14 am #2549060Dax
Additionally, is it possible to have all of the items – logo, menu and CTA responsive and on one line? Right now they are stacking and it looks awful.
Thank you
February 27, 2023 at 11:48 am #2549107Ying
StaffCustomer SupportAnd how can I change the colour of the text?
The theme style for menu bar item links overrides the button style, try adding this CSS:
.main-navigation .menu-bar-items a.cta-button { color: #ffffff; }Additionally, is it possible to have all of the items – logo, menu and CTA responsive and on one line?
Try adding this CSS:
@media(max-width: 768px) { .inside-navigation.grid-container { flex-wrap: nowrap; } }February 27, 2023 at 11:56 am #2549116Dax
Hi again,
The first code worked….
The second has made the button margin-less etc?
February 27, 2023 at 12:28 pm #2549145Ying
StaffCustomer SupportThe second has made the button margin-less etc?
The second code makes sure that all the elements in the navigation won’t wrap to the second line on mobile.
It does what has to be done to ensure they don’t wrap 🙂 -
AuthorPosts
- You must be logged in to reply to this topic.