根据屏幕高度选择下拉高度

时间:2017-10-06 19:58:18

标签: javascript jquery html css selectize.js

美好的一天!

我有一个下拉选择使用" selectize"插入。 如何根据屏幕高度设置下拉内容高度,因为我的下拉选项中有很多项目,所以将它们呈现在一个更长的列表而不仅仅是一个简短的列表中会很好..

目前我所拥有的。 enter image description here

期望的输出

enter image description here

我尝试使用下面的代码,只是在控制台上播放,但它也不起作用。

.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;*/

}

请提出任何建议,谢谢!

1 个答案:

答案 0 :(得分:3)

我设法通过

达到理想的输出
.selectize-dropdown, .selectize-dropdown.form-control{
    height: 90vh !important;
}

.selectize-dropdown-content{
    max-height: 100% !important;
    height: 100% !important;
}