我有多个具有不同形式的选项卡,我在该选项卡中使用Jquery插件来替换selects。
问题在于选项卡或selectBox插件以某种方式显示:块;更改selectBox插件的宽度和两个相同的选项在不同的选项卡中有不同的宽度,它的宽度差很小,但在很好的形式上,它看起来非常糟糕。
下面是问题的演示:http://jsfiddle.net/kvdKr/1/
有人知道怎么解决这个问题吗?谢谢
更新:
通过使用$(“select”).selectBox(‘before’);在打开选项卡并使用$(“select”).selectBox()之前解决了这个问题,这再次解决了问题。更多细节:https://github.com/claviska/jquery-selectBox/issues/11
发布于 2012-01-11 21:12:10
因此,虽然我不知道直接的问题是什么,但原因如下:
<div class="box"> <!-- I took the visible out of the class, if you only do this it will fix your problem, your select boxes will be the same width -->
<select id="amount" name="amount">
<option value="select">Amount</option>
<option value="1">500</option>
</select>
</div>
<div class="box">
<select id="amount" name="amount">
<option value="select">Amount</option>
<option value="1">500</option>
</select>
</div>然后,我在.ready函数中添加了这一行:
$(document).ready(function(){
$("select").selectBox();
$('div.box').first().addClass('box visible');// <== So now I forced your box visible class on .ready and it works like a dream
});这是一个解决办法,我承认,但它不是那么多的代码,它的工作;)
https://stackoverflow.com/questions/8826120
复制相似问题