20
20
$ . widget ( "ui.menubar" , {
21
21
version : "@VERSION" ,
22
22
options : {
23
+ autoExpand : false ,
23
24
buttons : false ,
24
25
menuIcon : false ,
25
26
position : {
@@ -89,7 +90,11 @@ $.widget( "ui.menubar", {
89
90
that . _close ( ) ;
90
91
return ;
91
92
}
92
- if ( ( that . open && event . type == "mouseenter" ) || event . type == "click" ) {
93
+ if ( ( that . open && event . type == "mouseenter" ) || event . type == "click" || that . options . autoExpand ) {
94
+ if ( that . options . autoExpand ) {
95
+ clearTimeout ( that . timer ) ;
96
+ }
97
+
93
98
that . _open ( event , menu ) ;
94
99
}
95
100
} )
@@ -115,6 +120,22 @@ $.widget( "ui.menubar", {
115
120
. attr ( "role" , "menuitem" )
116
121
. attr ( "aria-haspopup" , "true" )
117
122
. wrapInner ( "<span class='ui-button-text'></span>" ) ;
123
+
124
+ if ( that . options . autoExpand ) {
125
+ input . bind ( "mouseleave.menubar" , function ( event ) {
126
+ that . timer = setTimeout ( function ( ) {
127
+ that . _close ( ) ;
128
+ } , 150 ) ;
129
+ } ) ;
130
+ menu . bind ( "mouseleave.menubar" , function ( event ) {
131
+ that . timer = setTimeout ( function ( ) {
132
+ that . _close ( ) ;
133
+ } , 150 ) ;
134
+ } )
135
+ . bind ( "mouseenter.menubar" , function ( event ) {
136
+ clearTimeout ( that . timer ) ;
137
+ } ) ;
138
+ }
118
139
119
140
// TODO review if these options are a good choice, maybe they can be merged
120
141
if ( that . options . menuIcon ) {
0 commit comments