Accordion Help

Accordion Help

Hi,

I need to create an accordion, I got it working half way.

My problem is that some accordion times, also have "accordion children" that need to work the same way.

but right now, when i click on an accordion child it closes that whole tab. However when i click on it again the right child is open.

how can i set it to not close, when clicking on an accordion inside a tab?



  1.  jQuery(document).ready(function(){
  2.     //Set default open/close settings
  3.            // $('.ekflexmenu_submenu_items_hidden').hide(); //Hide/close all containers
  4.             $('.sidemenu_toggle:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

  5.             //On Click
  6.             $('.sidemenu_toggle').click(function(){
  7.            if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
  8.            $(this).css("color","#ff0000");
  9.    $(this).children('div').css("background-position","-500px center");
  10.            $('.sidemenu_toggle').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
  11.          //  $(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
  12.            }
  13.            else{
  14.             $(this).css("color","");
  15. $(this).children('div').css("background-position","0px center");
  16.        }
  17.        $(this).next().slideToggle('slow');
  18.            return false; //Prevent the browser jump to the link anchor
  19.             });

  20. $('.sidemenu_toggle:not(.selected)').next().hide();
  21.    $('.sidemenu_toggle:not(.selected)').children('div').css("background-position","0px center"); 
  22.   });