sydcanem / bootstrap-contextmenu

Context menu plugin for Twitter's Bootstrap framework
http://sydcanem.com/bootstrap-contextmenu/
645 stars 193 forks source link

Add after event #44

Closed david-nguyen closed 10 years ago

david-nguyen commented 10 years ago

Thanks for the script, I've modified it to add a after call once the menu was closed :)

Modify constructor LN42

 this.before = this.options.before || this.before
 this.onItem = this.options.onItem || this.onItem
 this.after = this.options.after || this.after

Modify closemenu LN79

,closemenu: function(e) {
      if(this.getMenu().hasClass('open'))
           this.after();
      this.getMenu().removeClass('open');
 }

Add default after function LN92

,after: function(e) {
      return true;
 }

Add to clearMenus LN170

,clearMenus: function(e) {
      if (!e.ctrlKey) {
        $('[data-toggle=context]').each(function() {
              if(this.getMenu().hasClass('open'))
                   this.after();
          this.getMenu()
            .removeClass('open');
        });
      }
  }
sydcanem commented 10 years ago

Thanks could you make a pull request please.