Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Multicolor jQuery Accordion widget

I received a question about having different elements in a Jquery Accordion with different colors. There are probably many ways to achieve this. Below I'll show you how to do it with just a little bit of javascript.

$(document).ready(function(){
$("#accordion").accordion();
var my_colors = ["aqua", "black", "blue", "fuchsia", "green", "lime"];
$('.ui-accordion-header').each( function(i) {
$(this).css("background-color",my_colors[i])
});
});

What is important to note here is the use of the css classes added by jQuery to an accordion to retrieve all accordion headers. I hope I answered the question... If I can find the time I'll try to put a polished demo on the web with complete source code.


This post first appeared on Homunculus, please read the originial post: here

Share the post

Multicolor jQuery Accordion widget

×

Subscribe to Homunculus

Get updates delivered right to your inbox!

Thank you for your subscription

×