简体   繁体   English

SumoSelect 的全选选项与 select 下拉列表中的其他选项重叠

[英]SumoSelect's select-all option overlaps other options in select drop down

I have a SumoSelect select drop down in my CodeIgniter application and inside that the select all option has smaller height as compared to other items, and due to this, select all option overlaps other option in the drop down list.我的CodeIgniter应用程序中有一个SumoSelect select 下拉列表,其中select all选项与其他项目相比具有较小的高度,因此, select all选项与下拉列表中的其他选项重叠。 I have tried to increase the height of select-all option element using jQuery but I think the height of <option> can not be modified manually.我尝试使用jQuery增加select-all选选项元素的高度,但我认为<option>的高度不能手动修改。 So please tell how to resolve this overlapping issue?那么请告诉我如何解决这个重叠问题?

Code:代码:

<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>

Overlapping Issue:重叠问题: 在此处输入图像描述

Here is a workaround.这是一个解决方法。 Catch the opening event of sumo select and dynamically set the height of first element with jquery.捕捉相扑选择的opening事件,用jquery动态设置第一个元素的高度。

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

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

});

在此处输入图片说明

Add this css class and adjust height and padding.form-group >.SumoSelect.open >.optWrapper>.select-all {height: 50px;padding: 6px 35px;}添加这个 css class 并调整高度和 padding.form-group >.SumoSelect.open >.optWrapper>.select-all {height: 50px;padding: 6px 35px;}

As a quick fix in Firefox, this solution worked for me.作为 Firefox 中的快速修复,此解决方案对我有用。 I added the following style to my css file for the page.我在页面的 css 文件中添加了以下样式。

.SumoSelect .select-all {
  display: table-cell;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM