I've got a div with the ID testimonials that has a height of auto. In the div are a number of section's that vary in height. I am currently running a script that only shows one section at a time, and animates the opacity. I want to find a solution that allows for #testimonials to animate the height when a new section is displayed.
HTML Structure
<div id="testimonials">
  <section>
    <p>This is the first quote.</p>
  </section>
  <section>
    <p>This is the second quote. It is taller than the previous section.</p>
  </section>
  <section>
    <p>This is the third quote. It is even taller than the previous section two sections.</p>
  </section>
</div>
jQuery
(function() {
  var testimonials     = $("#testimonials section");
  var testimonialIndex = -1;
  function showNextTestimonial() {
    ++testimonialIndex;
    testimonials.eq(testimonialIndex % testimonials.length)
    .fadeIn(2000)
    .delay(2000)
    .fadeOut(2000, showNextTestimonial);
  }
showNextTestimonial();
})();
You can see my CodePen for a working example.
What I've Tried
Trying to use max-height to animate the height is impossible since I'm not using :hover, and that seems to be the only way to make it work. I also can't use transform: scale() for the same reason that it relies on :hover. The solutions I am finding either seem to rely on :hover, only fire on pageload, window.onresize, onclick, or something else that doesn't update when the visible section changes.
How do I animate the height of a div that's content is being changed out every 6 seconds like above?
 
     
     
    