diff --git a/src/ajax.js b/src/ajax.js index 7408ce4..3ab4510 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1244,10 +1244,10 @@ function mttMenu(container, options) this.caller = caller; $caller = $(caller); var offset = $caller.offset(); - var x2 = $(window).width() + $(document).scrollLeft() - this.container.outerWidth() - 1; + var x2 = $(window).width() + $(document).scrollLeft() - this.container.outerWidth(true) - 1; var x = offset.left < x2 ? offset.left : x2; var y = offset.top+caller.offsetHeight-1; - if(y + this.container.outerHeight() > $(window).height() + $(document).scrollTop()) y = offset.top - this.container.outerHeight(); + if(y + this.container.outerHeight(true) > $(window).height() + $(document).scrollTop()) y = offset.top - this.container.outerHeight(); this.container.css({ position: 'absolute', top: y, left: x /*, 'min-width': $caller.width()*/ }).show(); var menu = this; $(document).bind('click.mttmenuclose', function(e){ menu.close(e) }); @@ -1258,9 +1258,9 @@ function mttMenu(container, options) { var offset = this.$caller.offset(); var x = offset.left+this.$caller.outerWidth(); - if(x + this.container.outerWidth() > $(window).width() + $(document).scrollLeft()) x = offset.left - this.container.outerWidth() - 1; + if(x + this.container.outerWidth(true) > $(window).width() + $(document).scrollLeft()) x = offset.left - this.container.outerWidth() - 1; var y = offset.top + this.parent.container.offset().top-this.parent.container.find('li:first').offset().top; - if(y + this.container.outerHeight() > $(window).height() + $(document).scrollTop()) y = $(window).height() + $(document).scrollTop()- this.container.outerHeight() - 1; + if(y + this.container.outerHeight(true) > $(window).height() + $(document).scrollTop()) y = $(window).height() + $(document).scrollTop()- this.container.outerHeight(true) - 1; this.container.css({ position: 'absolute', top: y, left: x /*, 'min-width': this.$caller.outerWidth()*/ }).show(); this.menuOpen = true; } diff --git a/src/style.css b/src/style.css index fbce5ac..7d797ab 100644 --- a/src/style.css +++ b/src/style.css @@ -191,7 +191,11 @@ li.task-completed .task-note-block .task-note { text-decoration:line-through; } .mtt-btnmenu { border-bottom:1px dashed #ccc; padding:2px 2px; -moz-user-select:none; -webkit-user-select: none; } .mtt-btnmenu:hover { cursor:pointer; border-bottom:1px solid #bbb; } -.mtt-btnmenu-container { overflow: hidden; z-index:100; background-color:#f9f9f9; border:1px solid #cccccc; padding:3px; -moz-box-shadow:1px 2px 5px rgba(0,0,0,0.5); -webkit-box-shadow:1px 2px 5px rgba(0,0,0,0.5); } +.mtt-btnmenu-container { + overflow:hidden; z-index:100; + background-color:#f9f9f9; border:1px solid #cccccc; padding:3px; + -moz-box-shadow:1px 2px 5px rgba(0,0,0,0.5); -webkit-box-shadow:1px 2px 5px rgba(0,0,0,0.5); margin:0px 7px 7px 0px; +} .mtt-btnmenu-container ul { list-style: none; padding:0; margin:0; } .mtt-btnmenu-container li { margin:1px 0px; padding:2px; cursor:pointer; color:#000; white-space:nowrap; } .mtt-btnmenu-container li:hover { background-color:#316AC5; color:white; }