Skip to content

Commit 486b1f0

Browse files
committed
Fixing Issue swisnl#18 - sub-menus wouldn't adjust their width according to min-width and min-height.
1 parent a570575 commit 486b1f0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

jquery.contextMenu.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,16 @@ var // currently active contextMenu trigger
950950
var $this = this;
951951
if (root === undefined) {
952952
root = opt;
953+
console.log('UPDATING');
954+
// determine widths of submenus, as CSS won't grow them automatically
955+
// position:absolute > position:absolute; min-width:100; max-width:200; results in width: 100;
956+
// kinda sucks hard...
957+
opt.$menu.find('ul').andSelf().css({position: 'static', display: 'block'}).each(function(){
958+
var $this = $(this);
959+
$this.width($this.css('position', 'absolute').width())
960+
.css('position', 'static');
961+
}).css({position: '', display: ''});
953962
}
954-
955963
// re-check disabled for each item
956964
opt.$menu.children().each(function(){
957965
var $item = $(this),
@@ -1007,7 +1015,7 @@ function splitAccesskey(val) {
10071015

10081016
for (var i=0, k; k = t[i]; i++) {
10091017
k = k[0].toUpperCase(); // first character only
1010-
// theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, screw it.
1018+
// theoretically non-accessible characters should be ignored, but different systems, different keyboard layouts, ... screw it.
10111019
// a map to look up already used access keys would be nice
10121020
keys.push(k);
10131021
}

0 commit comments

Comments
 (0)