Support » Plugin: Max Mega Menu » Display submenu by hovering page element

  • I am struggling with this: I am trying to display one particular submenu when hovering image which is somewhere on page. I found jQuery code that could achieve it, but it is not working. I modified IDs to correspond with my menu.

    <script>
    $( ".obr-hl-strana" ).hover(
     function($) {
        $('a.open-a-panel').on('click', function(e) {
            e.preventDefault();
            var panelToShow = $("#mega-menu-item-16 > a.mega-menu-link");
            $('#mega-menu-header-menu').data('maxmegamenu').showPanel(panelToShow);
        });
    }
    );
    
    </script>

    Can anyone help with this please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi Squatter,

    I think you will want something more like this:

    <script>
     function($) {
        $('.obr-hl-strana').on('hover', function(e) {
            e.preventDefault();
            var panelToShow = $("#mega-menu-item-16 > a.mega-menu-link");
            $('#mega-menu-header-menu').data('maxmegamenu').showPanel(panelToShow);
        });
    });
    </script>

    See http://api.jquery.com/on/ for more info on the “on” function in jQuery.

    I think, if you want the sub menu to open and stay open, then you will need to set the Event for the menu to ‘Click’. I have never heard of someone doing a similar thing so you may need to experiment, and you may find it does not give the results you are looking for, but hopefully that code gets you closer to the answer.

    Thread Starter squatter1

    (@squatter1)

    Thanks for quick reply. But unfortunately it is not working. Could you please look at it on my website please? I can’t figure out what is wrong.

    https://novy.kvalitar.cz/

    Plugin Author megamenu

    (@megamenu)

    Where is the JavaScript? It should be output somewhere after maxmegamenu.js.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display submenu by hovering page element’ is closed to new replies.