I’m actually working on a jQuery UI accordion and I’m trying to find how I can know when the panel is opening or closing so I can execute a different function for both events.
$("#accordion").bind('accordionactivate', function(event, ui) {
$(ui.newPanel).find('.itemChildren').empty();
var index = $("#accordion").accordion("option", "active");
alert($.isEmptyObject(ui.oldPanel));
if( index !== false){
var item = {};
item[Settings.id_item] = Tree.getTreeItemId(ui.newPanel);
Tree.displayChildren(item, Settings, Url);
}
});
I tried to watch if the object is empty: no
I tried to look if the active index is false: only false when the last panel closed
Thanks for your help!
This is probably not the best way to do it but it works for me, I just verify if the class from the newPanel exists: