【发布时间】:2016-06-30 18:22:33
【问题描述】:
我很好奇如何改变kartik select2 widget?中选择的悬停颜色
我使用yii2。我的app 在code 之后呈现dropdown 的select2 元素:
<span class="dropdown-wrapper" aria-hidden="true"></span>
但里面什么都没有。那么哪些类负责选择hover e.t.c?
【问题讨论】:
我很好奇如何改变kartik select2 widget?中选择的悬停颜色
我使用yii2。我的app 在code 之后呈现dropdown 的select2 元素:
<span class="dropdown-wrapper" aria-hidden="true"></span>
但里面什么都没有。那么哪些类负责选择hover e.t.c?
【问题讨论】:
这就是kartik select2 创建 DOM 的方式。在<span> 上方,您会找到<select> 标签。
<select id="w13" class="form-control select2-hidden-accessible" name="kv-type-01" data-s2-options="s2options_d6851687" data-krajee-select2="select2_f12d7f7f" style="display:none" tabindex="-1" aria-hidden="true">
<option value="">Select a type...</option>
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
<option value="4">Fourth</option>
<option value="5">Fifth</option>
</select>
<span class="select2 select2-container select2-container--krajee select2-container--below select2-container--open select2-container--focus" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="true" tabindex="0" aria-labelledby="select2-w13-container" aria-owns="select2-w13-results" aria-activedescendant="select2-w13-result-9vjw-5">
<span class="select2-selection__rendered" id="select2-w13-container">
<span class="select2-selection__placeholder">Select a type ...</span>
</span>
<span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
</span>
</span>
<span class="dropdown-wrapper" aria-hidden="true">
</span>
</span>
在<select> 选项标签上应用悬停效果将解决您的问题。
【讨论】:
select option:hover { background-color: lime; } 。不工作。