File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 < script src ="../../ui/jquery.ui.menubar.js "> </ script >
1414 < script >
1515 $ ( 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+ }
1622 $ ( "#bar1" ) . menubar ( {
1723 position : {
1824 within : $ ( "#demo-frame" ) . add ( window ) . first ( )
1925 } ,
20- select : function ( event , ui ) {
21- $ ( "<div/>" ) . text ( "Selected: " + ui . item . text ( ) ) . appendTo ( "#log" ) ;
22- }
26+ select : select
2327 } ) ;
2428
2529 $ ( ".menubar-icons" ) . menubar ( {
2933 position : {
3034 within : $ ( "#demo-frame" ) . add ( window ) . first ( )
3135 } ,
32- select : function ( event , ui ) {
33- $ ( "<div/>" ) . text ( "Selected: " + ui . item . text ( ) ) . appendTo ( "#log" ) ;
34- }
36+ select : select
3537 } ) ;
3638 } ) ;
3739 </ script >
Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ $.widget( "ui.menubar", {
4949 } ,
5050 select : function ( event , ui ) {
5151 ui . item . parents ( "ul.ui-menu:last" ) . hide ( ) ;
52- that . _trigger ( "select" , event , ui ) ;
5352 that . _close ( ) ;
5453 // TODO what is this targetting? there's probably a better way to access it
5554 $ ( event . target ) . prev ( ) . focus ( ) ;
55+ that . _trigger ( "select" , event , ui ) ;
5656 }
5757 } )
5858 . hide ( )
@@ -94,7 +94,7 @@ $.widget( "ui.menubar", {
9494 if ( that . options . autoExpand ) {
9595 clearTimeout ( that . timer ) ;
9696 }
97-
97+
9898 that . _open ( event , menu ) ;
9999 }
100100 } )
@@ -120,7 +120,7 @@ $.widget( "ui.menubar", {
120120 . attr ( "role" , "menuitem" )
121121 . attr ( "aria-haspopup" , "true" )
122122 . wrapInner ( "<span class='ui-button-text'></span>" ) ;
123-
123+
124124 if ( that . options . autoExpand ) {
125125 input . bind ( "mouseleave.menubar" , function ( event ) {
126126 that . timer = setTimeout ( function ( ) {
You can’t perform that action at this time.
0 commit comments