树菜单弹出位置优化

This commit is contained in:
Van 2014-12-18 16:56:21 +08:00
parent ffa61c83b2
commit 7da9a49d2c
1 changed files with 11 additions and 2 deletions

View File

@ -249,8 +249,12 @@ var tree = {
$fileRMenu.find(".remove").addClass("disabled");
}
var top = event.clientY - 10;
if ($fileRMenu.height() + top > $('.content').height()) {
top = top - $fileRMenu.height() - 25;
}
$fileRMenu.css({
"top": event.clientY - 10 + "px",
"top": top + "px",
"left": event.clientX + "px",
"display": "block"
}).show();
@ -269,8 +273,13 @@ var tree = {
$dirRMenu.find(".create").addClass("disabled");
}
var top = event.clientY - 10;
if ($dirRMenu.height() + top > $('.content').height()) {
top = top - $dirRMenu.height() - 25;
}
$dirRMenu.css({
"top": event.clientY - 10 + "px",
"top": top + "px",
"left": event.clientX + "px",
"display": "block"
}).show();