diff options
author | Felix Nagel <info@felixnagel.com> | 2011-05-24 23:24:30 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2011-05-24 23:24:30 +0200 |
commit | ed77e04dc192e53ad4437a45e4a8c4d841b27c8f (patch) | |
tree | 7c2754fa9cab8e11736d2647ab67fe8b2fe5e1ad | |
parent | c918a8219c5b5ff9008a87eccd5dd2d1652de840 (diff) | |
download | jquery-ui-ed77e04dc192e53ad4437a45e4a8c4d841b27c8f.tar.gz jquery-ui-ed77e04dc192e53ad4437a45e4a8c4d841b27c8f.zip |
improved: width handling for list and newelement
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 5974f85a5..2068535ec 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -157,11 +157,12 @@ $.widget("ui.selectmenu", { } }); - // original selectmenu width - var selectWidth = this.element.width(); - + // set width when not set via options + if (!o.width) { + o.width = this.element.outerWidth(); + } // set menu button width - this.newelement.width(o.width ? o.width : selectWidth); + this.newelement.width(o.width); // hide original selectmenu element this.element.hide(); @@ -354,14 +355,11 @@ $.widget("ui.selectmenu", { this.newelement.add(this.list).addClass(transferClasses); } - // original selectmenu width - var selectWidth = this.element.width(); - // set menu width to either menuWidth option value, width option value, or select width if (o.style == 'dropdown') { - this.list.width(o.menuWidth ? o.menuWidth : (o.width ? o.width : selectWidth)); + this.list.width(o.menuWidth ? o.menuWidth : o.width); } else { - this.list.width(o.menuWidth ? o.menuWidth : (o.width ? o.width - o.handleWidth : selectWidth - o.handleWidth)); + this.list.width(o.menuWidth ? o.menuWidth : o.width - o.handleWidth); } // calculate default max height |