Skip to content

Commit

Permalink
Merge pull request #27 from ninio/master
Browse files Browse the repository at this point in the history
Fix calling onItem for all the instances of contextmenu that use the same dropdown.
  • Loading branch information
sydcanem committed Aug 10, 2013
2 parents e8d0d5f + 673d4b9 commit ea82ef6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bootstrap-contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
var tp = this.getPosition(e, $menu);
$menu.attr('style', '')
.css(tp)
.data('_context_this_ref', this)
.addClass('open');


Expand Down Expand Up @@ -96,7 +97,9 @@
var $target = $(this.$elements.attr('data-target'));

$target.on('click.context.data-api', function (e) {
_this.onItem.call(this,e,$(e.target));
if($(this).data('_context_this_ref') == _this) {
_this.onItem.call(this,e,$(e.target));
}
});

$('html').on('click.context.data-api', function (e) {
Expand Down

0 comments on commit ea82ef6

Please sign in to comment.