<s:select list="newCostTypeMap" theme="simple" cssClass="myCombobox" cssStyle="width:200px" data-options="editable:false,panelHeight:'auto'" /> $('.myCombobox').combobox({ onShowPanel:function(){//面板自适应 //宽度超过500则显示500,最小宽度显示和下拉框的宽度一致 $(this).combobox('panel').css('display','inline-block').width('auto');//让div根据文字内容自动适应宽度,作一行显示 var width = $(this).combobox('panel').width(); if (width > 500) { $(this).combobox('panel').width("500"); } else if (width < 200) { $(this).combobox('panel').width("200"); } else {//解决在IE下出现滚动条的问题 $(this).combobox('panel').width(width + 20);//下拉面板 $(this).combobox('panel').parent().width('auto');//面板外面还包裹了一层父节点 } //默认面板高度自适应,若是超出,则指定 var height = $(this).combobox('panel').height(); if (height > 200) { $(this).combobox('panel').height("200"); }else{ //$(this).combobox('panel').height("auto"); } } });