- list.style.display = 'block';
- list.style.maxHeight = '';
- const maxHeight = list.getBoundingClientRect().height + 10;
- list.style.maxHeight = '0px';
- list.style.overflow = 'hidden';
- list.style.transition = 'max-height ease-in-out 240ms';
-
- let transitionEndBound = onTransitionEnd.bind(this);
- function onTransitionEnd() {
- list.style.overflow = '';
- list.style.maxHeight = '';
- list.style.transition = '';
- list.style.display = `block`;
- list.removeEventListener('transitionend', transitionEndBound);
- }
-
- setTimeout(() => {
- requestAnimationFrame(() => {
- list.style.maxHeight = `${maxHeight}px`;
- list.addEventListener('transitionend', transitionEndBound)
- });
- }, 1);