Bootstrap 4 uses the class .collapsing
to animate the width/height of an .collapse-element while opening/closing it. Unfortunately the actual change is approached by adding the width/height as an inline style to the element and adding and removing the class at the start and end of the transition. Therefore it's quite hard to customize the transition (e.g. change timing or fade in/out instead of width transition).
What I've tried so far:
- Adding the css property
transition:none
to the.collapsing
class: This does help get rid of the transition but opening/closing is still delayed by the transition time, since the class still gets added for a few millis before the actual change takes place. - Adding custom css keyframes to the
.collapsing
class: Since the same class is used for opening and closing, the same animation is shown for both.
Is there any way to change the transition e.g. to fade in/out (change of opacity) or do I have to build a custom version of the bootstrap.js?