我已經得到了一些標記,看起來像這樣:jQuery的第n /每三個
<h3>Mgmt</h3>
<div class="ManagementOperations">bla bla </div>
<div class="ManagementOperations">bla bla </div>
<div class="ManagementOperations">bla bla </div>
<div class="ManagementOperations">bla bla </div>
<div class="ManagementOperations">bla bla </div>
<h3>People</h3>
<div class="people">bla bla </div>
<div class="people">bla bla </div>
<div class="people">bla bla </div>
<div class="people">bla bla </div>
<div class="people">bla bla </div>
<div class="people">bla bla </div>
每個div的2去數 - 100兩種類別的
我要添加class rowEnd到每個第三個'ManagementOperations'和每個第三個'ManagementOperations'時,計數會在班級發生變化時重置。
任何想法?我使用這個效果差:
$(".ManagementOperations:nth-child(4n)").addClass('rowEnd');