Skip to content

Commit 759e47a

Browse files
committed
Selectmenu: fixed positioning with overflow in IE
1 parent 21d96f1 commit 759e47a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,14 @@ $.widget( "ui.selectmenu", {
204204
this.menu.menu( "focus", event, currentItem );
205205
}, 1);
206206

207-
if ( !this.options.dropdown ) {
207+
if ( !this.options.dropdown ) {
208+
// center current item
209+
if ( this.menu.outerHeight() < this.menu.prop( "scrollHeight" ) ) {
210+
this.menuWrap.css( "left" , -10000 );
211+
this.menu.scrollTop( this.menu.scrollTop() + currentItem.position().top - this.menu.outerHeight()/2 + currentItem.outerHeight()/2 );
212+
this.menuWrap.css( "left" , "auto" );
213+
}
214+
208215
$.extend( this.options.position, {
209216
my: "left top",
210217
at: "left top",

0 commit comments

Comments
 (0)