Boostrap multiselect菜单在单击选择按钮时添加窗口滚动条 在菜单的最右侧放置多选,但期望下拉菜单按钮的位置自动调整,这不会发生,例如弹出窗口的方式。
$('.select').multiselect({
enableClickableOptGroups: true,
includeSelectAllOption: true,
onDropdownShown: function(event) {
resetDropdownHeight();
}
});
并尝试添加onDropdownShown事件,如下所示
function resetDropdownHeight(){
$_dropdownMenu = $('select#testmodal').parent().find('ul');
console.log(this);
if ($_dropdownMenu !== null) {
$_dropdownMenu.css('left', '55%');
$_dropdownMenu.css('right', '5%');
}
}
下面是它的HTML
<select multiple="multiple" id="testmodal" class="dropdown-lenthy subtypemultiple version-enableClickableOptGroups-disabled right-dropdown form-control col-md-12 col-sm-12 col-xs-12 firstdll dropdown-menu-right">
<option value="1-1">loremu test wright node care must thiis line to read content</option>
<option value="1-2">loremu test wright node care must thiis line to read content (with Lower/Upper Cap if any)</option>
<option value="1-3">loremu test wright node care must thiis line to read content (fortnightly)</option>
<option value="1-4">loremu test wright node care must thiis line to read content(weekly)</option>
</select>