本文介紹了如何在 CSS 中為 Dropkick 插件單獨定位多個下拉列表的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
跟進:如何通過修改這個制作自定義樣式下拉的jQuery插件來獲取相對單位而不是px的輸出?
參考:http://jamielottering.github.com/DropKick/
給定以下JS:
dropdownTemplate = [
'<div class="dk_container" id="dk_container_{{ id }}" tabindex="{{ tabindex }}">',
'<a class="dk_toggle">',
'<span class="dk_label">{{ label }}</span>',
'</a>',
'<div class="dk_options">',
'<ul class="dk_options_inner">',
'</ul>',
'</div>',
'</div>'
].join(''),
如何分配自定義 ID 或以其他方式單獨定位每個 dk_toggle 實例?我正在創建多個下拉列表,但修改寬度(每個鏈接問題)的唯一方法是定位 dk_toggle 類,該類沒有為每個實例分配 ID.
How can I assign a custom ID or otherwise individually target each dk_toggle instance? I am creating multiple dropdowns, but the only way to modify the width (per linked question) is to target the dk_toggle class, which does not have an ID assigned to each instance.
推薦答案
DropKick 有主題,所以你可以這樣做:
DropKick has themes, so you would do something like this:
$('select.a').dropkick({ theme: 'black' });
$('select.b').dropkick({ theme: 'white' });
然后按照你的風格:
.dk_theme_black { background:black; color:white;}
.dk_theme_white { background:white; color:black;}
這篇關于如何在 CSS 中為 Dropkick 插件單獨定位多個下拉列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!