1
votes

I'm using jquerySlideToggle to open/close some divs under each other and create an accordion effect, inside each of these divs there is more content, some other divs, texts, images, etc.

The slide function is working fine, but it does not show the transition/animation effect opening or closing, you can only see the content after the div is totally opened (after the slide animation finish), but I would like to start seeing the content since the beginning of the animation.

Below follows the code I'm using:

function Accordion(div_name){
    for(i = 0; i < 6; i++) { 
        if (div_name == 'a' + i ) {
            } else {
                $('#a' + i ).hide();
            }  
        };  
  $('#' + div_name).slideToggle();
  location.href ='frota.php#a' + div_name;             
}; 

Anyone knows what is happening and how can I fix it?

Tks

1

1 Answers

0
votes

Try to this code:

function Accordion(div_name){
for(i = 0; i < 6; i++) { 
    if (div_name == 'a' + i ) {
        } else {
            $('#a' + i ).slideUp();
        }  
    };  
$('#' + div_name).slideToggle();
location.href ='frota.php#a' + div_name;             
};