How to trigger a JavaScript function after "Bootstrap: collapse plugin" transition is done

You need to handle the hidden event on the collapse plugin.

From Docs

hidden - This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).

$('#myCollapsible').on('hidden', function () {
  // do something…
})

As pointed by @Francesc in the comment for Bootstrap 3.0 we have to use

$('#myCollapsible').on('hidden.bs.collapse', function () {
  // do something…
})

If you are using bootstrap 3.0 its pretty easy. shown.bs.collapse is the event that is fired when the element shown transition is complete. I believe you are looking for something like this.

$('#myCollapsible').on("shown.bs.collapse", function(){
 //trigger content change
 //this code will be triggered when the collapse transition is completed 
 //that is your myCollapsible element will have 'in' in your class
});

I've never used the collapse plugin, but in the documentation it says there is a callback called 'hidden' that should be called once the element transition has finished:

$('#myCollapsible').on('hidden', function () {
    // do something…
});