- This topic has 17 replies, 4 voices, and was last updated 3 years, 2 months ago by David.
-
AuthorPosts
-
February 1, 2021 at 1:22 am #1641231Henk
Hello,
I want to change the standard hamburger menu icon/close icon with a custom one just like in this example. How would I do that without downloading the responsive menu plugin?
I just want to replace the current SVG icons with simple CSS buttons.
February 1, 2021 at 10:02 am #1641894TomLead DeveloperLead DeveloperHi there,
I’m not too sure I’m seeing the difference between that example and the default theme style?
Changing the SVGs to other SVGs is possible using filters: https://generatepress.com/forums/topic/mobile-menu-icon/#post-1620506
Changing from SVGs to a completely different method is more challenging. I wrote some info on that here: https://docs.generatepress.com/article/animated-hamburgers/
February 1, 2021 at 11:33 pm #1642455HenkHi Tom,
I my example the hamburger menu is a black square with the 3 horizontal white lines in it. My hamburger menu are only 3 black lines without the square.
I am going to try to change the SVGs with the method you have provided in the above post.
Thanks for your help!
February 2, 2021 at 3:37 am #1642681HenkSorry,
Two questions about the above method:
1) I am using the Off Canvas Panel for my mobile menu, so I really don’t need the close (X) icon when the hamburger menu is clicked (because there is already a close (X) icon in the Off Canvas Panel). What filter do I need to make sure the hamburger icon does not change into the (X) icon when clicked? I know it’s only a fraction of a second when I see the (X) icon, because the Off Canvas Panel appears after clicking the hamburger menu, but I still want to disable it.
2) I noticed the entire “inside-navigation grid-container” is clickable in the mobile view. But I want only the hamburger menu and the Mobile Menu Label (Menu) to be clickable. Is this possible?
Thanks!
February 2, 2021 at 12:10 pm #1643395YingStaffCustomer SupportHi Henk,
Try this CSS to hide the x icon.
.toggled .icon-menu-bars svg:nth-child(2) { display: none; }
For the 2nd question, could you link us to the site in question? You could use the private info field.
Thanks!
February 2, 2021 at 4:28 pm #1643596HenkHello Ying,
Thanks for the CSS provided, it worked!
For my second question, my website is not live yet, but I have provided a screenshot in the private information field so you can see the problem that occurs.
February 3, 2021 at 2:18 am #1643945HenkHere is an EXAMPLE of what I am trying to achieve (watch in mobile view to see the hamburger menu).
Is this achievable with GeneratePress?
And I still have not managed to fix the problem I described in the post above.
Any suggestions?
Thanks!
February 3, 2021 at 3:27 am #1644005DavidStaffCustomer SupportHi there,
try adding this CSS:
@media(max-width: 768px) { .main-navigation .inside-navigation { justify-content: center; } .main-navigation button.menu-toggle { flex-grow: unset; background-color: #00f; /* background color toggle */ border-radius: 100%; line-height: 55px; /* Adjust height to match elements width */ } .main-navigation .main-nav { flex-basis: 100%; order: 3; } .main-navigation:not(.slideout-navigation):not(.toggled) .main-nav>ul { display: block; max-height: 0; overflow: hidden; pointer-events: none; transition: all 0.3s ease-in-out; } .main-navigation:not(.slideout-navigation).toggled .main-nav>ul { max-height: 2000px; overflow: visible; transition: all 0.3s ease-in-out; } }
February 3, 2021 at 4:36 am #1644075HenkHi David,
The CSS you provided gives me a very small oval icon. I want a round icon that overlays my hero image, just like the example. I tried to tweak the above css, but I was not able to get the same result.
February 3, 2021 at 6:36 am #1644183DavidStaffCustomer SupportI commented tis line in the CSS:
line-height: 55px; /* Adjust height to match elements width */
You will need to inspect the
button.menu-toggle
to see its total width, and set the line-height to match.Positioning it over a header element – its doable but tricky if we can’t see the site. Any chance you can open a tunnel to it or upload it to a staging site.
February 4, 2021 at 4:23 am #1645364HenkHello David,
There is was no width in the
button.menu-toggle
So I added itwidth: 48px; height: 48px;
I don’t know what you mean by “set the line-height to match”. Does this mean the line height should be 48px too?I don’t feel comfortable opening a tunnel and I have no host yet, that’s why I am designing my site locally. Is is possible to share the ‘Positioning over a header element’ code and adjust it along the way? I can send screenshots and share code.
February 4, 2021 at 5:01 am #1645421HenkMy current code:
@media(max-width: 768px) { .main-navigation .inside-navigation { justify-content: center; } .main-navigation button.menu-toggle { width: 48px; height: 48px; color: #ffffff; border: 4px solid #ffffff; flex-grow: unset; background-color: #006699; /* background color toggle */ border-radius: 100%; line-height: 48px; /* Adjust height to match elements width */ } .main-navigation .main-nav { flex-basis: 100%; order: 3; }
I have added a width and height to the
button.menu-toggle
but I am not sure what theline-height: 55px;
does, and how much it should be?February 4, 2021 at 5:16 am #1645438DavidStaffCustomer SupportFebruary 4, 2021 at 6:03 am #1645494HenkThanks david!
It was 23px. The button looks exactly the way I want to.
I still need some help to positioning it over the hero/header element.
I have been trying to copy the css from my example website to get the same effect, but so far no luck.
February 4, 2021 at 7:01 am #1645727DavidStaffCustomer SupportIn your
.main-navigation button.menu-toggle
CSS add some top negative margineg,
margin-top: -10px;
This should pull the toggle up over the element above it.
-
AuthorPosts
- You must be logged in to reply to this topic.