From: kborchers Date: Sun, 10 Jul 2011 04:30:35 +0000 (-0500) Subject: Menu: Added close on click outside using technique from popup X-Git-Tag: 1.9m6~98^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9f5050ee063ed4c9e6191fc58ef151254cf54e76;p=jquery-ui.git Menu: Added close on click outside using technique from popup --- diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index b93c95531..770e0252a 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -170,6 +170,14 @@ $.widget( "ui.menu", { } } }); + + this._bind( document, { + click: function( event ) { + if ( !$( event.target ).closest( ".ui-menu" ).length ) { + this.closeAll(); + } + } + }); }, _destroy: function() {