summaryrefslogtreecommitdiffstats
path: root/public/javascripts/context_menu.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/javascripts/context_menu.js')
-rw-r--r--public/javascripts/context_menu.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js
index 1b7da8991..ca2a9bec9 100644
--- a/public/javascripts/context_menu.js
+++ b/public/javascripts/context_menu.js
@@ -87,7 +87,8 @@ function contextMenuCreate() {
function contextMenuShow(event) {
var mouse_x = event.pageX;
- var mouse_y = event.pageY;
+ var mouse_y = event.pageY;
+ var mouse_y_c = event.clientY;
var render_x = mouse_x;
var render_y = mouse_y;
var dims;
@@ -110,7 +111,7 @@ function contextMenuShow(event) {
menu_width = $('#context-menu').width();
menu_height = $('#context-menu').height();
max_width = mouse_x + 2*menu_width;
- max_height = mouse_y + menu_height;
+ max_height = mouse_y_c + menu_height;
var ws = window_size();
window_width = ws.width;
@@ -123,12 +124,22 @@ function contextMenuShow(event) {
} else {
$('#context-menu').removeClass('reverse-x');
}
+
if (max_height > window_height) {
render_y -= menu_height;
$('#context-menu').addClass('reverse-y');
+ // adding class for submenu
+ if (mouse_y_c < 325) {
+ $('#context-menu .folder').addClass('down');
+ }
} else {
- $('#context-menu').removeClass('reverse-y');
+ // adding class for submenu
+ if (window_height - mouse_y_c < 345) {
+ $('#context-menu .folder').addClass('up');
+ }
+ $('#context-menu').removeClass('reverse-y');
}
+
if (render_x <= 0) render_x = 1;
if (render_y <= 0) render_y = 1;
$('#context-menu').css('left', (render_x + 'px'));
@@ -136,7 +147,6 @@ function contextMenuShow(event) {
$('#context-menu').show();
//if (window.parseStylesheets) { window.parseStylesheets(); } // IE
-
}
});
}