From b2d02482fa950cb51524312e4b2ec43a6eacee46 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Thu, 16 Jun 2011 23:51:17 +0200 Subject: [PATCH] fixed: some issue with height and refresh, thx to trollix, see: https://github.com/fnagel/jquery-ui/issues/133 --- ui/jquery.ui.selectmenu.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 061a979e3..7e3ba1689 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -366,19 +366,29 @@ $.widget("ui.selectmenu", { this.list.width(o.menuWidth ? o.menuWidth : o.width - o.handleWidth); } - // calculate default max height - if (o.maxHeight) { - // set max height from option - if (o.maxHeight < this.list.height()) { - this.list.height(o.maxHeight); - } + // reset height to auto + this.list.css("height", "auto"); + var listH = this.list.height(); + + if ( o.maxHeight && o.maxHeight < listH) { + this.list.height( o.maxHeight ); } else { - if (!o.format && ($(window).height() / 3) < this.list.height()) { - o.maxHeight = $(window).height() / 3; - this.list.height(o.maxHeight); - } - } - + var winH = $( window ).height() / 3; + if ( winH < listH ) this.list.height( winH ); + } + + // if ( o.maxHeight ) { + // if (o.maxHeight < listH) { + // this.list.height( o.maxHeight ); + // } + // } else { + // var winH = $( window ).height() / 3; + // if ( winH < listH ) { + // this.list.height( winH ); + // console.log("set height (winH): " + winH); + // } + // } + // save reference to actionable li's (not group label li's) this._optionLis = this.list.find('li:not(.' + self.widgetBaseClass + '-group)'); -- 2.39.5