0

Is there any way to run some function before and accordion it's fully opened?

Here's the code:

            $.each($('.accordion-toggle'),function(){
                $(this).click(function() {
                    if($(this).hasClass("collapsed")){
                         //loading content via ajax
                    };
                });

I tried to use .on('show') functions and changing data-toggle with javascript opening and closing content, but it seems to be very complicated due to existing code.

4

1 回答 1

0

尝试这个...

$.each($('.accordion-toggle'),function(){
      $(this).click(function() {
            if($(this).hasClass("collapsed")){
                \\loading content via ajax
            }
      });
});

你忘记了“;”......

于 2013-02-01T23:00:05.070 回答