I have a set of elements like this
<div class="wrap">
<div class="block active">
<p>content</p>
</div>
<div class="block">
<p>content</p>
</div>
<div class="block">
<p>content</p>
</div>
<div class="block">
<p>content</p>
</div>
</div>
I need a function to infinitely loop on these elements (block) moving the active class from one to the next. I've looked at using .each() for this but I don't really understand how to use it. Any help is greatly appreciated.