Skip to content Skip to sidebar Skip to footer

Jquery Contextmenu Dropdown

I am using this contextMenu template: http://medialize.github.com/jQuery-contextMenu/index.html and i would like to change the place where the menu appears, i mean i want it to ALW

Solution 1:

$('.item').contextMenu('menu',{
    onShowMenu: function(e, menu) {
        e.pageX=100;
        e.pageY=400;
        return menu;
    }
  }
);

Solution 2:

determinePosition - provided in documentation of the plugin.

Determine the position of the menu in respect to the given trigger object.

determinePosition: function(opt.$menu)

Ex:

$.contextMenu({
    selector: 'span.context-menu',
    determinePosition: function($menu){
        // Position using jQuery.ui.position // http://api.jqueryui.com/position/
        $menu.css('display', 'block')
            .position({ my: "center top", at: "center bottom", of: this, offset: "0 5"})
            .css('display', 'none');
    }
});

Worked for me!! I know this is a 9 year old question, and I hope the next person viewing it will not spend an hour fixing it.

Post a Comment for "Jquery Contextmenu Dropdown"