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?
- jQuery(document).ready(function(){
- //Set default open/close settings
- // $('.ekflexmenu_submenu_items_hidden').hide(); //Hide/close all containers
- $('.sidemenu_toggle:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
- //On Click
- $('.sidemenu_toggle').click(function(){
- if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
- $(this).css("color","#ff0000");
- $(this).children('div').css("background-position","-500px center");
- $('.sidemenu_toggle').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
- // $(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
- }
- else{
- $(this).css("color","");
- $(this).children('div').css("background-position","0px center");
- }
- $(this).next().slideToggle('slow');
- return false; //Prevent the browser jump to the link anchor
- });
- $('.sidemenu_toggle:not(.selected)').next().hide();
- $('.sidemenu_toggle:not(.selected)').children('div').css("background-position","0px center");
- });