diff --git a/project/static/js/commons.js b/project/static/js/commons.js index 24d1426..2ceeada 100644 --- a/project/static/js/commons.js +++ b/project/static/js/commons.js @@ -1,4 +1,5 @@ $(document).ready(function() { + var show_cabinet = false; $('.has-datepicker').datepicker({dateFormat: 'dd.mm.yy'}); $('#reasons').mouseout(function(e){ $('.extended-block').removeClass('active'); @@ -30,7 +31,6 @@ $(document).ready(function() { $('#other_docs').mouseover(function(e){ $('.other_docs_menu').show(); var other_width = $('#other_docs').width(); - console.log(other_width); $('.other_docs_menu').css({width: other_width}); }); $('.other_docs_menu').mouseout(function(e){ @@ -45,13 +45,36 @@ $(document).ready(function() { var close_action = $(this).data('close'); $.cookie(close_action, true, {path: '/'}); }); - $('#cabinet-show').hover(function(e){ + function hide_popup() { + setTimeout(function(){ + console.debug('popup', $('#cabinet-popup').data('hover')); + console.debug('link', $('#cabinet-show').data('hover')); + if ($('#cabinet-popup').data('hover') + $('#cabinet-show').data('hover') == 0) { + $('#cabinet-popup').hide(); + } else { + $('#cabinet-popup').show(); + } + }, 1000) + } + $('#cabinet-show').click(function(e){ e.preventDefault(); $('#cabinet-popup').show(); }); + $('#cabinet-show').mouseover(function(e){ + $(this).data('hover',1); + $('#cabinet-popup').show(); + }); + $('#cabinet-popup').mouseover(function(e){ + $(this).data('hover',1); + $('#cabinet-popup').show(); + }); + $('#cabinet-popup').mouseout(function(e){ + $(this).data('hover',0); + hide_popup(); + }); $('#cabinet-show').mouseout(function(e){ - e.preventDefault(); - //$('#cabinet-popup').hide(); + $(this).data('hover',0); + hide_popup(); }); $('.captcha_refresh').click(function(e) {