code: function(scope, element, height) {
      // We remove the collapse CSS class to prevent a transition when we change to height: auto
      element.removeClass('collapse');
      element.css({ height: height });
      // It appears that  reading offsetWidth makes the browser realise that we have changed the
      // height already :-/
      var x = element[0].offsetWidth;
      element.addClass('collapse');
    }
docs: CSS transitions don't work with height: auto, so we have to manually change the height to a specific value and then once the animation completes, we can reset the height to auto. Unfortunately if you do this while the CSS transitions are specified (i.e. in the CSS class "collapse") then you trigger a change to height 0 in between. The fix is to remove the "collapse" CSS class while changing the height back to auto - phew!