aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-09 22:40:14 -0400
committerJörn Zaefferer <joern.zaefferer@gmail.com>2011-07-09 22:40:14 -0400
commit954419f94e5df411e9c52adaf51d60dc2903b7d2 (patch)
tree58d17a134a1319b3329f72a3d946728580351232 /ui
parent0245b72af87d3022f5dd780d03ff03d4751eca64 (diff)
parent40aa8f57151b0a01f33389482e5676725fd50ae7 (diff)
downloadjquery-ui-954419f94e5df411e9c52adaf51d60dc2903b7d2.tar.gz
jquery-ui-954419f94e5df411e9c52adaf51d60dc2903b7d2.zip
Merge remote branch 'kborchers/menubar-autoExpand'
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.menubar.js23
1 files changed, 22 insertions, 1 deletions
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 ) {