gpt4 book ai didi

jquery - SelectBoxIt 以 100% 宽度的 Bootstrap 形式输入

转载 作者:行者123 更新时间:2023-12-01 07:14:40 25 4
gpt4 key购买 nike

我在 Bootstrap 3 水平表单中使用 SelectBoxIt 输入 ( http://gregfranko.com/jquery.selectBoxIt.js/ )。我希望输入随着表单的宽度而增长和折叠,但是当将宽度设置为 100% 时,它们最终会折叠。

我创建了一个 JSFiddle 来展示我的问题,想知道擅长 CSS 的人是否可以提出解决方案或建议?

http://jsfiddle.net/oceanexplorer/a5AZF/

HTML

<form class="form-horizontal">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label class="col-xs-4 col-sm-4 col-md-4 col-lg-4 control-label">Option1</label>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<select name="foo">
<option value="1">Foo1</option>
<option value="2">Foo2</option>
<option value="3">Foo3</option>
<option value="4">Foo4</option>
<option value="5">Foo5</option>
<option value="6">Foo with a really, really long text line that we shall use in order to test the wrapping of text within an option or optgroup</option>
</select>
</div>
</div>
</div>

<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label class="col-xs-4 col-sm-4 col-md-4 col-lg-4 control-label">Option1</label>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<select name="foo">
<option value="1">Foo1</option>
<option value="2">Foo2</option>
<option value="3">Foo3</option>
<option value="4">Foo4</option>
<option value="5">Foo5</option>
<option value="6">Foo with a really, really long text line that we shall use in order to test the wrapping of text within an option or optgroup</option>
</select>
</div>
</div>
</div>
</form>

CSS

.selectboxit-container .selectboxit-options,
.selectboxit-container .selectboxit
{
width: 100%;
}

.col-xs-8,
.col.sm-8,
.col-md-8,
.col-lg-8
{
border: 1px solid black;
}

Javascript

$("select").selectBoxIt({
autoWidth: false
});

最佳答案

将容器包含在您的第一条规则中:

.selectboxit-container .selectboxit-options,
.selectboxit-container .selectboxit,
.selectboxit-container {
width: 100%;
}

http://jsfiddle.net/a5AZF/3/

关于jquery - SelectBoxIt 以 100% 宽度的 Bootstrap 形式输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20550109/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com