diff options
author | Felix Nagel <info@felixnagel.com> | 2011-09-28 00:03:52 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2011-09-28 00:18:36 +0200 |
commit | fd69abb8d05b3ac8273834f33e9b02b8d9be3632 (patch) | |
tree | 6e287c2a279e11434cce675d6b9214514608509a | |
parent | 68a369911a030ad010f71fbe96845d50a146b960 (diff) | |
download | jquery-ui-fd69abb8d05b3ac8273834f33e9b02b8d9be3632.tar.gz jquery-ui-fd69abb8d05b3ac8273834f33e9b02b8d9be3632.zip |
Selectmenu: improved width handling and visual style
-rw-r--r-- | themes/base/jquery.ui.selectmenu.css | 2 | ||||
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css index e69ec975f..95b1cf127 100644 --- a/themes/base/jquery.ui.selectmenu.css +++ b/themes/base/jquery.ui.selectmenu.css @@ -11,10 +11,10 @@ .ui-selectmenu-menu { padding: 0; margin: 0; position:absolute; top: 0; display: none; } .ui-selectmenu-menu .ui-menu .ui-menu-item { width: auto; } .ui-selectmenu-menu .ui-menu .ui-menu-item a { padding: 0.3em 1em 0.3em 1em; } -.ui-selectmenu-menu .ui-menu .ui-menu-item a.ui-state-focus { margin: -1px 0 -1px -1px; } .ui-selectmenu-menu .ui-menu li.ui-state-disabled { margin: 0; padding: 0; } .ui-selectmenu-menu .ui-menu li.ui-selectmenu-optgroup { font-weight: bold; line-height: 1.5; padding: 2px 0.4em; margin: 0.5em 0 0 0; } .ui-selectmenu-open { display: block; } +.ui-selectmenu-button { margin-right: 0; } .ui-selectmenu-button span.ui-icon { right: 0.5em; left: auto; } .ui-selectmenu-button span.ui-button-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em }
\ No newline at end of file diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index ccae38eea..a3a81ddcc 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -42,7 +42,7 @@ $.widget( "ui.selectmenu", { _create: function() { var self = this, options = this.options, - tabindex = this.element.attr( 'tabindex' ) + tabindex = this.element.attr( 'tabindex' ), // set a default id value, generate a new random one if not set by developer selectmenuId = self.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 ); @@ -72,7 +72,7 @@ $.widget( "ui.selectmenu", { tabindex: ( tabindex ? tabindex : self.element.attr( 'disabled' ) ? 1 : 0 ), id: self.ids[ 0 ], css: { - width: self.element.width() + width: self.element.outerWidth() }, 'aria-disabled': options.disabled, 'aria-owns': self.ids[ 1 ], @@ -172,9 +172,10 @@ $.widget( "ui.selectmenu", { }); // wrap list + var newelementWidth = self.newelement.outerWidth(); self.listWrap = $( options.wrapperElement ) .addClass( self.widgetBaseClass + '-menu' ) - .css( "width", ( options.dropdown ) ? self.element.width() : self.element.width() - options.iconWidth ) + .width( ( options.dropdown ) ? newelementWidth : newelementWidth - options.iconWidth ) .append( self.list ) .appendTo( options.appendTo ); |