]> source.dussan.org Git - jquery-ui.git/commitdiff
Menu: Added close on click outside using technique from popup
authorkborchers <kris.borchers@gmail.com>
Sun, 10 Jul 2011 04:30:35 +0000 (23:30 -0500)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 12 Jul 2011 15:03:10 +0000 (11:03 -0400)
ui/jquery.ui.menu.js

index b93c9553198ff1ad7eca922ee4ec28c5d00fda82..770e0252a6076d83bd5abc3ffeb4c650a3167114 100644 (file)
@@ -170,6 +170,14 @@ $.widget( "ui.menu", {
                                }
                        }
                });
+
+               this._bind( document, {
+                       click: function( event ) {
+                               if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+                                       this.closeAll();
+                               }
+                       }
+               });
        },
 
        _destroy: function() {