Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix max height of the selectmenu to be one third of the window height
  • Loading branch information
thg2k committed Jan 17, 2015
commit f09ac7c3a3d1f04bfb555fbf54e8f740ef758c1c
11 changes: 10 additions & 1 deletion ui/selectmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ return $.widget( "ui.selectmenu", {
position: {
my: "left top",
at: "left bottom",
collision: "none"
collision: "flip"
},
width: null,

Expand Down Expand Up @@ -617,6 +617,15 @@ return $.widget( "ui.selectmenu", {
// so we add 1px to avoid the wrapping
this.menu.width( "" ).outerWidth() + 1
) );

// Reset the height of the menu and calculate the max height
this.menu.css( "height", "auto" );
var menuHeight = this.menu.height();
var maxMenuHeight = Math.round( $( window ).height() / 3 );

if ( maxMenuHeight < menuHeight ) {
this.menu.height( maxMenuHeight );
}
},

_getCreateOptions: function() {
Expand Down