medialize/jQuery-contextMenu — Issue #22: ZIndex issue with submenus
Author: a2daj
Created: 2012-01-05 19:45:42+00:00
State: open

I ran into an issue when invoking contextual menus near the far right edge of the window. Submenus were at the same zindex as the main context menu. I added a quick fix for our project. We don't use github at work so I didn't fork anything.

positionSubmenu: function($menu) {
if ($.ui && $.ui.position) {
// .position() is provided as a jQuery UI utility
// (...and it won't work on hidden elements)
$menu.css('display', 'block').position({
my: "left top",
at: "right top",
of: this,
collision: "fit"
}).css('display', '');
} else {
// determine contextMenu position
var offset = this.offset();
offset.top += 0;
offset.left += this.outerWidth();
$menu.css(offset);
}
//increases the submenu zindex by 1 to appear above the parent menu
$menu.css('z-index', parseInt(zindex(this)) + 1);
},