• Hey,

    I have coded an acf widget, that uses select2 dropdown. Basically users can search for pages.

    However select2 search, has an absolute position and closes the mega menu dropdown, ie class, “mega-toggle-on”, is removed due to hovering over the absolute positioned element inside the menu dropdown.

    I wondered if anyone else had successfully done this.

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi mjonesy1991,

    The sub menu will close whenever you click anywhere on the page background. If I remember correctly then select2 adds the dropdown html to the bottom of the document, so the menu thinks you are clicking outside of it, and therefore closes the sub menu.

    You can disable that behaviour by changing the ‘data-document-click’ attribute to ‘disabled’. Use this code as an example for the filter:

    https://www.megamenu.com/documentation/how-to-disable-the-sticky-menu-on-a-specific-page/

    … and change this attribute:

    $attributes[‘data-document-click’] = ‘disabled’;

    It would mean, on touch devices, the user would not be able to close the sub menu by clicking on the page background. The alternative would be to find an alternative to select2 that keeps the focus within the menu.

    Regards,
    Tom

Viewing 1 replies (of 1 total)

The topic ‘Select2 closes mega menu’ is closed to new replies.