File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1- <!doctype html>
1+ <!DOCTYPE html>
22< html >
33< head >
44 < title > Menu Visual Test: Default</ title >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ $.widget("ui.menubar", {
1313 } ,
1414 _create : function ( ) {
1515 var self = this ;
16- var items = this . element . children ( "button, a" ) ;
16+ var items = this . items = this . element . children ( "button, a" ) ;
1717 var o = this . options ;
1818
1919 this . element . addClass ( 'ui-menubar ui-widget-header ui-helper-clearfix' ) ;
@@ -69,17 +69,26 @@ $.widget("ui.menubar", {
6969
7070 } ) ;
7171 $ ( document ) . click ( function ( event ) {
72- ! $ ( event . target ) . closest ( ".ui-menubar" ) . length && items . next ( "ul" ) . hide ( ) ;
72+ ! $ ( event . target ) . closest ( ".ui-menubar" ) . length && self . _close ( ) ;
7373 } ) ;
7474 } ,
7575
76+ _close : function ( ) {
77+ this . items . next ( "ul" ) . hide ( ) ;
78+ this . items . removeClass ( "ui-state-active" ) ;
79+ } ,
80+
7681 _open : function ( event , menu ) {
77- this . active && this . active . menu ( "closeAll" ) . hide ( ) ;
82+ if ( this . active ) {
83+ this . active . menu ( "closeAll" ) . hide ( ) ;
84+ this . active . prev ( ) . removeClass ( "ui-state-active" ) ;
85+ }
86+ var button = menu . prev ( ) . addClass ( "ui-state-active" ) ;
7887 this . active = menu . show ( ) . position ( {
7988 my : "left top" ,
8089 at : "left bottom" ,
8190 offset : "0 -1" ,
82- of : menu . prev ( )
91+ of : button
8392 } ) . focus ( ) ;
8493 } ,
8594
You can’t perform that action at this time.
0 commit comments