Hi fire,
The theme toggle button is independant of the MMM mobile toggle button, and it’s not possible to combine the 2 different menu systems automatically. I’ve installed the theme and written a guide on hiding the theme toggle button here:
https://www.megamenu.com/documentation/dazzling/
Regards,
Tom
Hi Tom,
i know that it’s impossible to combine them without any changes on the theme. But did you ever thought of a simple function which can be assigned to any other button, link e.g. which is included in the megamenu js code?
<element onclick="toggleMegaMenu()">
Best regards
-
This reply was modified 8 years, 10 months ago by
fireemerald.
Hi fire,
Thanks for the suggestion, I’ll certainly consider it but it does open up other issues – i.e. if that function is used then the menu will also need to be hidden by default on mobile – so a fairly decent knowledge of JS and CSS would be needed to go along with that function.
If you are using your own JS all you would need to do is hide the menu to begin with (on mobile) then toggle the visibility of the mega menu when the theme button is clicked. The theme button will be different for every theme, so you would always need at least some custom code.
Regards,
Tom
Hiding the menu is just plain CSS code which can be added inside the custom css code section of megamenu. The javascript code can’t be attached in any section of megamenu.
For sure this would be only something for “advanced” users – but hey the js code would be only a few lines or am i wrong? Is there a way to get this implemented?
Hi Fire,
I don’t fully understand sorry.. the JS can be custom and “attached” to the menu.
Say you hide the menu on mobile using CSS with “display: none”, you can then use some custom JS to toggle the visibility of the menu which is attached to your button. e.g. something like (untested):
$(“.my-toggle-button”).on(‘click’, function() {
$(“#mega-menu-wrap-primary”).toggle();
});
Regards,
Tom
I mean with “The javascript code can’t be attached in any section” that there’s an Menu Themes -> Custom Styling -> CSS Editor where you can paste your custom CSS code. But there isn’t something like that for javascript snipplets. I think now you should understand what i mean, aren’t you?
-
This reply was modified 8 years, 10 months ago by
fireemerald.
Hi,
Sorry, yes I understand now. You’re quite right, there’s nowhere in MMM to add custom JS, but you can add it anywhere. If you are using a child theme with your own JS file then it can go in there. If your theme has a custom JS option then it can go in there also. Otherwise you could install the TC Custom JavaScript plugin and place it there instead.
I’ll definitely consider (and have been already) working out a way to ‘detach’ the mobile toggle button, I just need to figure out the best way to do it (code wise and from a users point of view – i.e. as least confusingly as possible).
Regards,
Tom
-
This reply was modified 8 years, 10 months ago by
megamenu.