-
AuthorPosts
-
July 18, 2019 at 11:00 am #1119870
Hi,
I remembered I had customized the mobile menu many years ago. It should have a javascript code which copy the main menu to mobile menu right before the mobile menu show up long time ago.
I have a new site which need to append the secondary menu into the mobile menu. However, I am not able to find the sample code on how to update this now. Is it still the same in the most updated enfold? And where can I find the sample code of this now?
Thanks,
AlexJuly 18, 2019 at 8:40 pm #1120001Hey boscotwcheung,
Could you please attach a mockup of what you’re trying to achieve?
Best regards,
VictoriaJuly 19, 2019 at 8:07 am #1120087I have 2 menus . One is main menu and the second one is secondary menu. On mobile, the enfold burger menu only shows the menu items from the main menu. I want to hide the secondary menu on mobile and append all the menu items from secondary menu to the burger menu.
I tried to add the following javascript to the header:
<script type=”text/javascript”>
jQuery(document).ready(function() {
var updatedMobileMenu = false;
jQuery(‘span.av-hamburger’).on(‘click’, function(){
if (jQuery(‘span.av-hamburger’).hasClass(‘is-active’)){
// nothing to do
} else {
setTimeout(function(){
if (updatedMobileMenu == false){
var topMenu = jQuery(‘#avia2-menu’).clone();
jQuery(‘#av-burger-menu-ul’).append(jQuery(topMenu).children());
updatedMobileMenu = true;
}
}, 500);
}
});
});
</script>It appends the secondary menu items to the burger menu successfully. However, the style is completely difference from other menu items on the burger menu. I found that the burger menu item structure is completely difference and I can’t directly clone and append them. Is there any javascript function which I can use to create mobile menu items on the fly?
Thanks,
AlexJuly 19, 2019 at 8:19 am #1120095if your topmenu isn’t to big ( and i suppose that there is not enough place to have there a great menu) – wouldn’t it be easier and on performance reasons better to add those items manually to the main-menu and set those menu-items to display none on non-mobile case?
July 22, 2019 at 3:01 pm #1120861Hi boscotwcheung,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.