gpt4 book ai didi

javascript - SumoSelect 的全选选项与选择下拉列表中的其他选项重叠

转载 作者:行者123 更新时间:2023-11-28 10:42:31 27 4
gpt4 key购买 nike

我有一个SumoSelect在我的 CodeIgniter 中选择下拉菜单应用程序及其内部 select all与其他项目相比,选项的高度较小,因此,select all选项与下拉列表中的其他选项重叠。我尝试增加 select-all 的高度使用 jQuery 的选项元素但我认为<option>的高度无法手动修改。那么请告诉如何解决这个重叠问题?

代码:

<select name="type" id="type" multiple="multiple" placeholder="Select a type" class="form-control SlectBox">                          
<?php foreach($types as $type) { ?>
<option>$type</option>
<?php } ?>
</select>

<script>
$(document).ready(function() {
window.asd = $('.SlectBox').SumoSelect({
csvDispCount: 3,
selectAll: 1,
captionFormat: '{0} types selected!',
captionFormatAllSelected:'All {0} types selected!'
});
<?php if(count(array_filter($Type_list))==0){?>
$('select.SlectBox')[0].sumo.selectAll();
<?php } ?>
});
</script>

重叠问题: enter image description here

最佳答案

这里有一个解决方法。捕获 sumo select 的 opening 事件并使用 jquery 动态设置第一个元素的高度。

$('#EmployeeType').on('sumo:opening', function () {

$('.select-all').css('height', '35px');

});

enter image description here

关于javascript - SumoSelect 的全选选项与选择下拉列表中的其他选项重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49789184/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com