treehouse : what would you like to learn today?
Web Design Web Development iOS Development

jquery automatic accordion: Select/get the active panel of accordion

  • hi guys, I'm working with a jquery accordion plugin. Its automatic, so even if you're not hovering or clicking over it, the panel moves smoothly at a set time. My problem is I want to add some effects on it like when the panel opens or gets active a child element (e.g Paragraph ) fades in.

      $('#accordion > li')._**what should I use here?**_(
                        function () {
                            var $this = $(this);
                            $this.stop().animate({'width':'480px'},500);
                            $('.heading',$this).stop(true,true).fadeOut();
                            $('.bgDescription',$this).stop(true,true).slideDown(500);
                            $('.description',$this).stop(true,true).fadeIn();
                        },
                        function () {
                            var $this = $(this);
                            $this.stop().animate({'width':'115px'},1000);
                            $('.heading',$this).stop(true,true).fadeIn();
                            $('.description',$this).stop(true,true).fadeOut(500);
                            $('.bgDescription',$this).stop(true,true).slideUp(700);
                        }
                    );
    

    What jquery api should I use to get the current/active/opened panel and bring in some effect. Thanks