diff options
author | Felix Nagel <info@felixnagel.com> | 2010-11-13 01:41:51 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2010-11-13 01:41:51 +0100 |
commit | 04876d37f1fbe4cd4e867a32b5cb09ee5c4cffc1 (patch) | |
tree | 00fd3c5ee7793ad36f71fe43dbfaab2f46c6d7f2 | |
parent | b6ce8d61be449fefdac6983c0f62aa3f57f46615 (diff) | |
download | jquery-ui-04876d37f1fbe4cd4e867a32b5cb09ee5c4cffc1.tar.gz jquery-ui-04876d37f1fbe4cd4e867a32b5cb09ee5c4cffc1.zip |
fixed: positioning issue
added: default max height based upon the viewport height
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index b58f8045b..9254a8141 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -241,9 +241,16 @@ $.widget("ui.selectmenu", { if(o.style == 'dropdown'){ this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width : selectWidth)); } else { this.list.width( (o.menuWidth) ? o.menuWidth : ((o.width) ? o.width - o.handleWidth : selectWidth - o.handleWidth)); } - //set max height from option - if(o.maxHeight && o.maxHeight < this.list.height()){ this.list.height(o.maxHeight); } - + // calculate default max height + if(o.maxHeight) { + //set max height from option + if (o.maxHeight < this.list.height()){ this.list.height(o.maxHeight); } + } else { + if (($(window).height() / 3) < this.list.height()) { + o.maxHeight = $(window).height() / 3 + this.list.height(o.maxHeight); + } + } //save reference to actionable li's (not group label li's) this._optionLis = this.list.find('li:not(.'+ self.widgetBaseClass +'-group)'); @@ -381,7 +388,6 @@ $.widget("ui.selectmenu", { var self = this; var disabledStatus = this.newelement.attr("aria-disabled"); if(disabledStatus != 'true'){ - this._refreshPosition(); this._closeOthers(event); this.newelement .addClass('ui-state-active'); @@ -392,6 +398,7 @@ $.widget("ui.selectmenu", { .attr('aria-hidden', false) .find('li:not(.'+ self.widgetBaseClass +'-group):eq('+ this._selectedIndex() +') a')[0].focus(); if(this.options.style == "dropdown"){ this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top'); } + this._refreshPosition(); this._trigger("open", event, this._uiHash()); } }, |