-
AuthorPosts
-
October 20, 2022 at 3:59 pm #1369616
Hello,
in mobile view, at the moment when a submenu is clicked, the one which was previously opened remains opened.
Is it possible to change setting so that only one submenu is opened?It will be more neat and navigation will be easier
Maybe with some code like this
https://splunktool.com/open-and-close-submenus-on-click-jqueryThank you
MauroOctober 20, 2022 at 4:20 pm #1369623can you try this:
https://kriesi.at/support/topic/searchfield-in-menu/#post-1366541October 20, 2022 at 4:34 pm #1369629Fantastic! A complex request solved in 20 minutes!
Thank you Guenni007October 20, 2022 at 5:20 pm #1369631Well, we already know each other through your footer area. ;)
October 20, 2022 at 5:25 pm #1369632October 20, 2022 at 5:28 pm #1369633@guenni007 Yes I certainly remember, the footer looks great!
November 29, 2022 at 6:14 pm #1374349Hello,
the code suggested by @guenni007 works like a charm in one site, but it does not do anything in another
######################
function only_one_submenu_open_on_burger(){
?>
<script>
window.addEventListener(“DOMContentLoaded”, function () {
(function($) {
$(‘body’).on( ‘click touch’, ‘.av-active-burger-items > a’, function () {
$(this).parent(‘li’).siblings().removeClass(‘av-show-submenu’);
$(this).parent(‘li’).siblings().find(‘ul’).slideUp( “fast”);
});
$(‘body’).on( ‘click touch’, ‘.av-active-burger-items .av-width-submenu > a’, function () {
$(this).closest(‘.sub-menu’).siblings().find(‘li’).removeClass(‘av-show-submenu’);
$(this).closest(‘.sub-menu’).siblings().find(‘ul’).slideUp( “fast”);
});
})(jQuery);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘only_one_submenu_open_on_burger’);
###################Please see in private content
Thank you
MauroDecember 2, 2022 at 7:29 pm #1374826Hi,
I see that in the first site that Guenni007’s code is working in your mobile menu has sub-menu items, for which the toggling occurs.
But on your second site I don’t see any sub-menus, all menu items are top level so there is nothing to toggle.
Try making the menu on the second site like the first site.Best regards,
MikeDecember 21, 2022 at 5:15 pm #1377023Hello,
I have made the same sub-structure (please see https://imgur.com/a/jbtUjMi)
and also was missing the option: Menu Icon Submenu items > Display submenu items on clickbut still it is not working as expected: if I click on SHOP, then OUR FRAGRANCES, and then I go to SAMPLES & KITS I should see all SHOP close, but it remains open
Thank you
MauroDecember 22, 2022 at 1:48 pm #1377110Hi,
I’m not sure what the issue is in the mobile menu, can you post your page publicly so @Guenni007 can also see the page and perhaps spot what can be adjusted in his code?Best regards,
MikeDecember 22, 2022 at 7:22 pm #1377141the script is placed in the footer – if you have checked on the other installation that jQuery should also be loaded in the footer ( see performance settings of enfold ) , you need to be sure that these snippets are loaded afterwards.
You can do this by giving the function a priority.add_action('wp_footer', 'only_one_submenu_open_on_burger', 999);
maybe that is the difference ?
December 23, 2022 at 3:40 pm #1377233999 make the difference
Once again, thank you very much Guenni007December 23, 2022 at 7:38 pm #1377263Hi,
Glad Guenni007 could help, thank you Guenni007, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Open on click a submenu and close the one previously opened’ is closed to new replies.