Javascript 引导选择不在窄字段上工作

Javascript 引导选择不在窄字段上工作,javascript,jquery,css,twitter-bootstrap,Javascript,Jquery,Css,Twitter Bootstrap,我正在使用它来增强移动站点 在我遇到问题的页面上,我已经成功地使用插件设置字段样式,如下所示: <div> <h:selectOneMenu value="#{bean.paymentChoices}" styleClass="selectpicker"> <f:selectItem itemValue="#{null}" itemLabel="Select an Option" /> <f:selectItems

我正在使用它来增强移动站点

在我遇到问题的页面上,我已经成功地使用插件设置字段样式,如下所示:

<div>
    <h:selectOneMenu value="#{bean.paymentChoices}" styleClass="selectpicker">
        <f:selectItem itemValue="#{null}" itemLabel="Select an Option" />
        <f:selectItems value="#{bea.paymentChoiceItems}" var="selectItem" itemLabel="#{selectItem.label}" itemValue="#{selectItem.value}" />
    </h:selectOneMenu>
</div>
但是,我有3个菜单也有selectpicker类,但是who's width设置为屏幕宽度的30%——JS无法设置selectpicker样式

有人知道为什么会这样吗?

发现问题(并解决了!):

我把宽度设置为30%,就像我在问题中提到的那样

我添加了一些媒体查询来检查屏幕宽度,并相应地设置下拉宽度,而不使用百分比,例如
width:npx
宽度:30%
发现问题(并已解决!):

我把宽度设置为30%,就像我在问题中提到的那样

我添加了一些媒体查询来检查屏幕宽度,并相应地设置下拉宽度,而不使用百分比,例如
width:npx
宽度:30%

$(".selectpicker").selectpicker('mobile);