jQuery addClass every other (n)


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $('.ukn-quote-wall .ukn-quote').each(function(i){
  2. var n = i % 3;
  3. $(this).addClass(
  4. n == 0 ? 'ukn-style-a' :
  5. n == 1 ? 'ukn-style-b' :
  6. n == 2 ? 'ukn-style-c' : '');
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.