mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* fixed context menu to work near browser borders
This commit is contained in:
parent
91ef891e09
commit
27ce3aef82
2 changed files with 14 additions and 4 deletions
13
src/ajax.js
13
src/ajax.js
|
|
@ -1250,7 +1250,11 @@ function mttMenu(container, options)
|
|||
this.caller = caller;
|
||||
$caller = $(caller);
|
||||
var offset = $caller.offset();
|
||||
this.container.css({ position: 'absolute', top: offset.top+caller.offsetHeight-1, left: offset.left , 'min-width': $caller.width() }).show();
|
||||
var x = offset.left;
|
||||
if(offset.left + this.container.outerWidth() > $(window).width()) x = $(window).width() - this.container.outerWidth() - 1;
|
||||
var y = offset.top+caller.offsetHeight-1;
|
||||
if(y + this.container.outerHeight() > $(window).height()) 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) });
|
||||
this.menuOpen = true;
|
||||
|
|
@ -1259,8 +1263,11 @@ function mttMenu(container, options)
|
|||
this.showSub = function()
|
||||
{
|
||||
var offset = this.$caller.offset();
|
||||
var dy = this.parent.container.offset().top-this.parent.container.find('li:first').offset().top
|
||||
this.container.css({ position: 'absolute', top: offset.top+dy, left: offset.left+this.$caller.outerWidth() /*, 'min-width': this.$caller.outerWidth()*/ }).show();
|
||||
var x = offset.left+this.$caller.outerWidth();
|
||||
if(x + this.container.outerWidth() > $(window).width()) 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()) y = $(window).height() - this.container.outerHeight() - 1;
|
||||
this.container.css({ position: 'absolute', top: y, left: x /*, 'min-width': this.$caller.outerWidth()*/ }).show();
|
||||
this.menuOpen = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,10 @@ div.task-note-area textarea { color:#999999; width:100%; display:block; height:6
|
|||
.mtt-btnmenu-container.mtt-menu-has-images li { padding-left:18px; }
|
||||
li.mtt-item-checked .menu-icon { float:left; width:16px; height:16px; margin-left:-18px; background:url(images/icons.gif) -16px -16px; }
|
||||
.mtt-btnmenu-container.mtt-menu-has-submenu li { padding-right:18px; }
|
||||
li.mtt-menu-indicator .submenu-icon { float:right; margin-right:-18px; width:16px; height:16px; background:url(images/icons.gif) -32px -16px no-repeat; }
|
||||
li.mtt-menu-indicator .submenu-icon {
|
||||
/*float:right; margin-right:-18px;*/ position:absolute; right:2px; /* specially for IE7 */
|
||||
width:16px; height:16px; background:url(images/icons.gif) -32px -16px no-repeat;
|
||||
}
|
||||
|
||||
.mtt-settings-table { width:100%; border-collapse:collapse; }
|
||||
.mtt-settings-table th, .mtt-settings-table td { border-bottom:1px solid #dedede; padding:8px; vertical-align:top; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue