Bootstrap-Select打开div下的选项 [英] Bootstrap-Select opens option under the div

查看:229
本文介绍了Bootstrap-Select打开div下的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个固定大小的div。假设50px。里面有一个下拉。我已使用引导选择使其可搜索。

I have a fixed size div. suppose 50px. Inside that I have a drop down. I've used bootstrap select to make it searchable.

<div style="height=40px;width:200%; overflow-x:scroll;" id="hugewidth">
  <select id="ss">
    <option>1</option>
    <option>1</option>
    <option>1</option>
    <option>1</option>
    <option>1</option>
  </select>
  <br/><br/><br/>
</div>

现在的问题是当我打开下拉列表,选项在 hugewidth div。我想要下拉框打开上面的div。请参阅可以清除问题的JSFiddle。

Now problem is when I open the dropdown , options goes under the hugewidth div. I want the dropdown to open above that div. See the JSFiddle that might clear the problem.

JSFiddle

查看!它在滚动条下。任何人都可以帮我这个?
我想要下拉选项div滚动滚动条。如果不可能,那么有什么办法根据下拉选项大小调整div的高度,同时打开和关闭? 下拉选项是动态的。

See!! It goes under the scrollbar. Can anyone please help me with this?? I want the dropdown option div to go over the scrollbar. If not possible, then is there any way to adjust the div height according to the dropdown option size while open and close? Dropdown options are dynamic.

还有一件事。是否可以阻止下拉菜单向上打开?示例: JSFiddle

One more thing. Is it possible to stop a dropdown to open upwards? Example: JSFiddle

推荐答案

您可以添加:

data-container="body"

选择元素。或另一个元素来显示下拉列表。请参阅:
http://jsfiddle.net/IceManSpy/Y9hyD/2/

to select element. Or another element to show dropdown over there. See it: http://jsfiddle.net/IceManSpy/Y9hyD/2/

这篇关于Bootstrap-Select打开div下的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆