Random (bullet) images for List Items in a UL?

I have a ul li sidebar generated from wordpress posts. The client has used different images for the bullet for each LI. Rather then adding a separate bullet manually, is there a way to do it that it chooses from a set of say 10 options?

was thinking Jquery function? Anyone ever done this?

Read More

THanks

Related posts

Leave a Reply

1 comment

  1. Perhaps something like the following:

    <style type="text/css">
    /* Add the styles here, incrementing the number of each one as you go (then change
       the 3 in the jQuery addClass method so it corresponds with the number of options
       available */
    li.bullet-0 { list-style-type: circle; }
    li.bullet-1 { list-style-type: disc; }
    li.bullet-2 { list-style-type: square; }
    </style>
    <Script type="text/javascript">
    $(document).ready(){
      $('ul > li').each(function(i,e){
        $(this).addClass('bullet-'+(i%3)); // change 3 to number of styles that are above.
      });
    });
    </script>
    

    jsFiddle link to show it being applied: http://www.jsfiddle.net/bradchristie/yxZ4m/