Use the css left attribute to determine if the menu is displayed instead of :visibe because it works with chrome, see jquery.is (": visible") does not work in Chrome .
You only need to determine if the menu is visible (use the css attribute on the left), because if the menu css left=0px means that it is visible, and after that, if click is outside the menu or not, and therefore if outside it.
Take a look at your upgrade script working fine by adding the following handle that detect external click:
JS:
$(document).click(function(e) { //if the menu is visible if($(".menu").css('left') =="0px"){ //if the click is outside of menu if($(e.target).closest('.menu').length == 0){ $('.closed').click(); } } });
Zakaria acharki
source share