aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--demos/menubar/default.html1
-rw-r--r--ui/jquery.ui.dialog.js5
-rw-r--r--ui/jquery.ui.menu.js8
-rw-r--r--ui/jquery.ui.menubar.js23
5 files changed, 34 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index e39040f5b..e5d3578f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ docs
*.diff
*.patch
.DS_Store
+.settings
diff --git a/demos/menubar/default.html b/demos/menubar/default.html
index 57a3209ce..6bd67b64a 100644
--- a/demos/menubar/default.html
+++ b/demos/menubar/default.html
@@ -23,6 +23,7 @@
});
$(".menubar-icons").menubar({
+ autoExpand: true,
menuIcon: true,
buttons: true,
position: {
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 0eba39842..e9cf67540 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -108,7 +108,8 @@ $.widget("ui.dialog", {
})
.mousedown(function( event ) {
self.moveToTop( false, event );
- }),
+ })
+ .appendTo( "body" ),
uiDialogContent = self.element
.show()
@@ -155,8 +156,6 @@ $.widget("ui.dialog", {
self._createButtons( options.buttons );
self._isOpen = false;
- uiDialog.appendTo( document.body );
-
if ( $.fn.bgiframe ) {
uiDialog.bgiframe();
}
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index b93c95531..770e0252a 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -170,6 +170,14 @@ $.widget( "ui.menu", {
}
}
});
+
+ this._bind( document, {
+ click: function( event ) {
+ if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+ this.closeAll();
+ }
+ }
+ });
},
_destroy: function() {
diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js
index 39e75924e..3df6d9a53 100644
--- a/ui/jquery.ui.menubar.js
+++ b/ui/jquery.ui.menubar.js
@@ -20,6 +20,7 @@
$.widget( "ui.menubar", {
version: "@VERSION",
options: {
+ autoExpand: false,
buttons: false,
menuIcon: false,
position: {
@@ -89,7 +90,11 @@ $.widget( "ui.menubar", {
that._close();
return;
}
- if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" ) {
+ if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) {
+ if( that.options.autoExpand ) {
+ clearTimeout( that.timer );
+ }
+
that._open( event, menu );
}
})
@@ -115,6 +120,22 @@ $.widget( "ui.menubar", {
.attr( "role", "menuitem" )
.attr( "aria-haspopup", "true" )
.wrapInner( "<span class='ui-button-text'></span>" );
+
+ if ( that.options.autoExpand ) {
+ input.bind( "mouseleave.menubar", function( event ) {
+ that.timer = setTimeout( function() {
+ that._close();
+ }, 150 );
+ });
+ menu.bind( "mouseleave.menubar", function( event ) {
+ that.timer = setTimeout( function() {
+ that._close();
+ }, 150 );
+ })
+ .bind( "mouseenter.menubar", function( event ) {
+ clearTimeout( that.timer );
+ });
+ }
// TODO review if these options are a good choice, maybe they can be merged
if ( that.options.menuIcon ) {