我使用Rubaxa sortable來製作可以排序的列表項。現在我想更改被拖動列表的背景顏色。 現在我使用文檔中提供的ghost類,但只有文本背景是彩色的,但我希望整個列表以及編號都具有背景色。 任何人都可以知道如何添加自定義類到可排序的通過javascript,以便我可以實現相同。更改Rubaxa中可拖拽列表的背景顏色排序?
Sortable.create(simpleList, {
ghostClass: "ghost"
});
.ghost {
color: #fff;
background-color: #c00;
}
.container {
text-align: center;
}
ol {
display: inline-block;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="http://rubaxa.github.io/Sortable/Sortable.js"></script>
<div class="container">
<ol id="simpleList" class="list-group">
<li>A Good Meal</li>
<li>A technical Improvement</li>
<li>Nonsense</li>
</ol>
</div>
如果我的理解是正確的給出.LIST組 – Snm
100%寬度你想整個'ul'到有相同的顏色?或者就是那個被拖動的特定'li'?因爲,正如你可以看到特定的'li'在被拖動時丟失了它的編號。所以請澄清你的問題 –
李不會鬆散其編號,如果列表是100%的寬度。只需檢查下面的片段 – Snm