soonic soonic - 1 year ago 62
jQuery Question

jquery accordion on open / close panel execute other code

I need to executed other js code after the panel is opened and after it is closed. How to do this? I didn't find any events in the jq accordion documentation for that.

Answer Source

You use the .activate event and observe what the parameters inside of the UI object look like:

activate: function( event, ui ) {
    if ($.isEmptyObject(ui.oldPanel)) {
        //was hidden previously, is visible now
    } else {
        //was visible previously, is hidden now

Here's the documentation on the even