Stripe Elements


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

This script will allow you to alternately place a style on objects (in this example, every other list item).


Copy this code and paste it in your HTML
  1. function stripeElement(objects, className) {
  2.  
  3. for (var i = 0; i < objects.length; i++) {
  4. if (i % 2) { objects[i].className += ' ' + className; }
  5. }
  6.  
  7. }
  8.  
  9. window.onload = function() {
  10.  
  11. if (document.getElementById('list')) {
  12. js_lib.css.mod.stripeElement(document.getElementById('list').getElementsByTagName('li'), 'tint');
  13. }
  14.  
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.