Add collapse and collapsed events.