Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selectize dropdown height base on screen height

Good Day!

I have a dropdown select using "selectize" plug-in. how can I set dropdown contents height base on screen height, since I have many items in my dropdown select, it would be nice to present them in a much longer list than just a short one..

currently what I have. enter image description here

desired output

enter image description here

I tried using below code, just from playing on console but, it doesnt work as well.

.selectize-dropdown, .selectize-dropdown.form-control{
        height: -webkit-fill-available !important;
        height: -moz-available !important;
        height: fill-available !important;
}

.selectize-dropdown-content{
   /* height: -webkit-fill-available !important;
        height: -moz-available !important;
        height: fill-available !important;*/

}

any suggestions please, Thanks!

like image 293
melvnberd Avatar asked Oct 06 '17 19:10

melvnberd


2 Answers

I manage to attain the desired out put by

.selectize-dropdown, .selectize-dropdown.form-control{
    height: 90vh !important;
}

.selectize-dropdown-content{
    max-height: 100% !important;
    height: 100% !important;
}
like image 189
melvnberd Avatar answered Oct 15 '22 00:10

melvnberd


.selectize-dropdown-content{
    max-height: 90vh !important;
}

This simple line of code will scale up/down nicely when options are added/removed from the select control.

Select with lots of options:

Lots of options

Select with few options:

Less options

like image 42
Twisted Whisper Avatar answered Oct 14 '22 23:10

Twisted Whisper