Skip to content

using multiple menu instances: add option to close menus which are already open #7

Open

Description

@hvgeertruy

Suppose I want to use more than one menu instance on one page

Changing #dl-menu to a class one is a nobrainer, but menu's that are already open should be closed (or at least be an option)

I fixed this for now by adding a trigger:

...
_initEvents : function() {
    var self = this;
        this.$trigger.on( 'click.dlmenu', function() {
            if( self.open ) {
                self._closeMenu();
            } 
            else {
                /*addition*/
                if(!self.open && $('.dl-active')[0]) {
                    $('.dl-active').trigger('click');
                }
                /*end of addition*/
                self._openMenu();
...

Activity

  1. grex22 commented on Sep 2, 2014

    @grex22

    Great addition @hvgeertruy -- This should probably be merged in. I can confirm this works great, and solves a relatively common problem.

  2. native-apps commented on Nov 13, 2014

    @native-apps

    Oh nice, I will have to implement this one later. Is it working correctly or has it been merged already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions