【发布时间】:2013-02-21 15:50:06
【问题描述】:
我有一个包含两列的主列表。在这些列中,每个 div 都有多个类,当您选择其中一个类时,我想对列进行排序,使它们均匀。这是我开始的一个例子:
<div class="left">
<div class="dot blue">blue one</div>
<div class="dot red">red one</div>
<div class="dot orange">orange one</div>
<div class="dot red">red two</div>
<div class="dot red">red three</div>
</div>
<div class="right">
<div class="dot red">red four</div>
<div class="dot blue">blue two</div>
<div class="dot blue">blue three</div>
<div class="dot blue">blue four</div>
<div class="dot orange">orange two</div>
</div>
单击“红色”的切换按钮后,我想隐藏除红点之外的所有内容,但在两列之间均匀地对红色进行排序。我可以正确隐藏所有内容,但不确定如何在“左”和“右” div 之间制作四个红色 div。这是我想要的输出:
<div class="left">
<div class="dot red">red one</div>
<div class="dot red">red two</div>
</div>
<div class="right">
<div class="dot red">red three</div>
<div class="dot red">red four</div>
</div>
提前致谢。
【问题讨论】:
标签: jquery html multiple-columns