如何在<select>"Heapbox"插件上反映禁用状态



如果select标记被禁用,有什么方法可以在heapboxhtml上应用类吗?

<select name="select-name" id="select-id" disabled>

否,不能覆盖css类禁用的属性。使用javascript将disable更改为enable。$('#select id').prop('disabled',false);

由于Heapbox没有这样的功能,我就是这么做的:

$("select").each(function () {
    if($(this).is(':disabled')){
        $(this).wrapAll(" <div class='select--disabled'></div>");
    }
}); 
$('select').heapbox();

然后使用css:

.select--disabled .heapBox{
    cursor: default;   
    pointer-events: none;
}
.select--disabled .holder{
    /* Style for the disabled state */
    background-color: #404040;
    box-shadow: none;
    color: #5A5A5A;
}

最新更新