Created
October 13, 2013 17:45
-
-
Save jbutko/6965098 to your computer and use it in GitHub Desktop.
jQuery, WP: Add class to every third element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .THIRD CLASS TO EVERY THIRD ARTICLE | |
var i = 1; | |
$('article').each(function() { | |
if(i++ % 3 == 0) | |
$(this).addClass('third'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment