2

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 ALWAYS Appear from the point i click to the bottom cause sometimes the lists contains lots of items and when its appears from the point clicked to upward Most of the list Disappear. i tried looking at the documentation and i came across the $.ui.position but i dont know if thats it and actually i didnt understand it.

Thanks In advance.

4

2 回答 2

0
$('.item').contextMenu('menu',{
    onShowMenu: function(e, menu) {
        e.pageX=100;
        e.pageY=400;
        return menu;
    }
  }
);
于 2012-12-21T23:17:55.583 回答
0

确定位置 - 在插件的文档中提供。

确定菜单相对于给定触发对象的位置。

确定位置:函数(opt.$menu)

前任:

$.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');
    }
});

为我工作!!我知道这是一个 9 年前的问题,我希望下一个查看它的人不会花一个小时来解决它。

于 2022-01-03T13:21:54.077 回答