Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery slideToggle - Call before slide

Can anyone suggest how to make a call within slideToggle before it opens/closes? Here is my situation:

$('.accordion .d_row .c_row').live('click', function() {

    $(this).nextAll('div.details').slideToggle(function() {

        if($(this).is(":hidden")){
            // do something
        } else {
            // do something
        }

    });
});

If i call anything where the //do something comment resides this getss fired whilst the element slides open. Is there a way to call, for example, a function first then perform the silde?

Cheers

like image 305
james Avatar asked Nov 28 '25 06:11

james


1 Answers

You can just run your code before calling slideToggle.

like image 146
SLaks Avatar answered Nov 29 '25 21:11

SLaks