您是否尝试过使用
.css()
设置宽度:
$('#drpTraj .ui-multiselect').css('width', '100%');
我对多个组件使用相同的样式。
您可以在
style
选项中设置具有您的 classes
的班级:
$('#drpTraj').multiselect({
nonSelectedText: 'Select items below',
classes : "your-class-name"
});
希望这有帮助。
发生这种情况是因为多选将您的选择转换为 a 标签,不够高兴,它删除了您应用于选择的所有类。 因此,让它服从你的最好方法是将类应用于对象 ID:
#drpTraj{
width: 350px;
}
希望这有帮助。
看起来我们遇到了这个组件的限制。我找到了两个场景来解决。 如果只想更改按钮,则将页面样式添加到此控件:
<style>
#drpTraj{ width: 800px; }
</style>
但是下拉列表仍然会很窄。 因此,为了修复下拉菜单,我在文件 jquery.multiselect.js 中更改了它
options: {
buttonWidth: 800, // (integer | string | 'auto' | null) Sets the min/max/exact width of the button.
但是,它会更改应用程序中所有多选的设置。 示例在这里:https://github.com/sam-klok/WebAppGrid