From afcc8d186a45ac0582855e2e33a6982be0470efb Mon Sep 17 00:00:00 2001 From: "Bc. Antonina Lebedeva" Date: Tue, 15 Mar 2016 18:04:39 +0100 Subject: [PATCH] fix_22059 --- public/javascripts/context_menu.js | 18 ++++++++++++++---- public/stylesheets/context_menu.css | 6 +++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index 2b48e35..6c57445 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 - } }); } diff --git a/public/stylesheets/context_menu.css b/public/stylesheets/context_menu.css index 1d02ebf..2b97993 100644 --- a/public/stylesheets/context_menu.css +++ b/public/stylesheets/context_menu.css @@ -25,10 +25,14 @@ #context-menu li.folder ul { position:absolute; left:168px; /* IE6 */ top:-2px; max-height:300px; overflow:hidden; overflow-y: auto; } #context-menu li.folder>ul { left:148px; } -#context-menu.reverse-y li.folder>ul { top:auto; bottom:0; } +#context-menu.reverse-y li.folder>ul, #context-menu li.folder.up>ul { top:auto; bottom:0; } #context-menu.reverse-x li.folder ul { left:auto; right:168px; /* IE6 */ } #context-menu.reverse-x li.folder>ul { right:148px; } +#context-menu.reverse-y li.folder.down>ul { + position:absolute; top:-2px; bottom: auto; max-height:300px; overflow:hidden; overflow-y: auto; +} + #context-menu a { text-decoration:none !important; background-repeat: no-repeat; -- 2.2.1