select2: control how many options to show

This worked:

html:

<select class="bigdrop">

jquery:

$(".bigdrop .select2-results").css("max-height","400px");

All select2 containers can be set the same height.

I just added this style, it's working for me

.select2-container--default .select2-results > .select2-results__options {
    max-height: 400px;
}

If you're looking to just display more options than the default without it looking bad, I just wrote a jQuery plugin (maximize-select2-height) to do exactly this. See the screenshots on the GitHub page (linked) to see how it behaves under different page layout circumstances.

Hope that's helpful to someone!

Tags:

Jquery