除了因为一张图片所以选中的元素比选择框的高度更大之外,一切都很好。
我知道如何改变宽度,但是如何改变高度以便在选择元素后显示完整内容(约150像素)?
以下是我的初始化代码:
<script>
$("#selboxChild").select2({
matcher: function(term, text) {
var t = (js_child_sponsors[text] ? js_child_sponsors[text] : text);
return t.toUpperCase().indexOf(term.toUpperCase()) >= 0;
},
formatResult: formatChild,
formatSelection: formatChild,
escapeMarkup: function(m) {
return m;
}
});
</script>
这是我的选择框:
<select id="selboxChild" style="width: 300px; height: 200px">
<option value="">No child attached</option>
</select>
澄清一下: 我不想改变每个选项的高度 我希望在选择子项后,选择框的高度可以改变。
因此,当页面首次加载时,它会显示"未选择子项" 当您单击下拉菜单并选择一个子项后,您将看到该子项的图片。 现在,我需要选择框扩展!否则,孩子的图片会被裁剪掉。
有人明白我的意思吗?