Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change jquery accordion header background colors?

Tags:

jquery-ui

Experts,

how to change the accordion menu header colors ? which style class name is this ? and how to set default selected tab ?

Please see the URL: http://jqueryui.com/demos/accordion/

Here i need to select section 2 when i am opening menu...

Please help me out to get changes.

like image 923
Jack Avatar asked Apr 27 '11 09:04

Jack


People also ask

How do you add background color to an accordion?

You can use the class "background-green" to add background color green or "text-green" to add the text green.

What does the jQuery accordion widget do?

The jQuery UI Accordion Widget can be used for the conversion of pairs of header & content panels into an accordion. The jQuery UI Accordion create event is used to trigger when the accordion is created. If an accordion widget is collapsed, then the ui. header and ui.


3 Answers

In order to change the background color of the header, in the css, identify the accordion header class name and then change the background property like so:

.ui-accordion-header{
   background:black;
}

In order to set the active index to 2, use the api: http://docs.jquery.com/UI/API/1.8/Accordion

Here you will find that you just have to call .accordion( "activate" , index ) on your jquery accordion object.

like image 81
Matt_Bro Avatar answered Oct 23 '22 14:10

Matt_Bro


A quick inspection tells me that you have to modify the css declaration of

.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited

and

.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited

As for the default selected tab you could do something like below:

$('#myAccordionId').accordion({}).accordion("activate" , indexOrSelector) //index in your case would be 1
like image 23
mmhan Avatar answered Oct 23 '22 13:10

mmhan


I did this and it helps:

#accordion h3{ 
  background:none;
  background-color:yellow;         
}

First reset the main color then set the favorite color.

like image 43
neda Derakhshesh Avatar answered Oct 23 '22 14:10

neda Derakhshesh