如何在单击链接时在一组元素上循环一个类。这是 HTML 的样子:
<section class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</section>
<a href="#">Iterate Class on Items</a>
JS:
$('a').click(function() {
$('.container .item').each(function() {
//cycle .active class on click
});
});