File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 13
13
< script src ="../../ui/jquery.ui.menubar.js "> </ script >
14
14
< script >
15
15
$ ( function ( ) {
16
+ function select ( event , ui ) {
17
+ $ ( "<div/>" ) . text ( "Selected: " + ui . item . text ( ) ) . appendTo ( "#log" ) ;
18
+ if ( ui . item . text ( ) == 'Quit' ) {
19
+ $ ( this ) . menubar ( 'destroy' ) ;
20
+ }
21
+ }
16
22
$ ( "#bar1" ) . menubar ( {
17
23
position : {
18
24
within : $ ( "#demo-frame" ) . add ( window ) . first ( )
19
25
} ,
20
- select : function ( event , ui ) {
21
- $ ( "<div/>" ) . text ( "Selected: " + ui . item . text ( ) ) . appendTo ( "#log" ) ;
22
- }
26
+ select : select
23
27
} ) ;
24
28
25
29
$ ( ".menubar-icons" ) . menubar ( {
29
33
position : {
30
34
within : $ ( "#demo-frame" ) . add ( window ) . first ( )
31
35
} ,
32
- select : function ( event , ui ) {
33
- $ ( "<div/>" ) . text ( "Selected: " + ui . item . text ( ) ) . appendTo ( "#log" ) ;
34
- }
36
+ select : select
35
37
} ) ;
36
38
} ) ;
37
39
</ script >
Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ $.widget( "ui.menubar", {
49
49
} ,
50
50
select : function ( event , ui ) {
51
51
ui . item . parents ( "ul.ui-menu:last" ) . hide ( ) ;
52
- that . _trigger ( "select" , event , ui ) ;
53
52
that . _close ( ) ;
54
53
// TODO what is this targetting? there's probably a better way to access it
55
54
$ ( event . target ) . prev ( ) . focus ( ) ;
55
+ that . _trigger ( "select" , event , ui ) ;
56
56
}
57
57
} )
58
58
. hide ( )
@@ -94,7 +94,7 @@ $.widget( "ui.menubar", {
94
94
if ( that . options . autoExpand ) {
95
95
clearTimeout ( that . timer ) ;
96
96
}
97
-
97
+
98
98
that . _open ( event , menu ) ;
99
99
}
100
100
} )
@@ -120,7 +120,7 @@ $.widget( "ui.menubar", {
120
120
. attr ( "role" , "menuitem" )
121
121
. attr ( "aria-haspopup" , "true" )
122
122
. wrapInner ( "<span class='ui-button-text'></span>" ) ;
123
-
123
+
124
124
if ( that . options . autoExpand ) {
125
125
input . bind ( "mouseleave.menubar" , function ( event ) {
126
126
that . timer = setTimeout ( function ( ) {
You can’t perform that action at this time.
0 commit comments