From: tommy tomson Date: Mon, 30 Apr 2012 00:00:41 +0000 (+0200) Subject: close one menu (like the notifications menu) when another one is opened (like it... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ab908469ae89cbc7ba3b45b25fd85668e51abaea;p=friendica.git close one menu (like the notifications menu) when another one is opened (like it is done when clicking somewhere else) (thx to ^mw) --- diff --git a/js/main.js b/js/main.js index ac238bf6aa..6a26324419 100644 --- a/js/main.js +++ b/js/main.js @@ -73,7 +73,16 @@ setupFieldRichtext(); /* popup menus */ + function close_last_popup_menu() { + if(last_popup_menu) { + last_popup_menu.hide(); + last_popup_button.removeClass("selected"); + last_popup_menu = null; + last_popup_button = null; + } + } $('a[rel^=#]').click(function(e){ + close_last_popup_menu(); menu = $( $(this).attr('rel') ); e.preventDefault(); e.stopPropagation(); @@ -90,12 +99,7 @@ return false; }); $('html').click(function() { - if(last_popup_menu) { - last_popup_menu.hide(); - last_popup_button.removeClass("selected"); - last_popup_menu = null; - last_popup_button = null; - } + close_last_popup_menu(); }); // fancyboxes