Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to animate height change on Bootstrap 3 Carousel

I know there is this question. The proposed solution doesn't work for Bootstrap 3 unfortunately (although it does for bs 2.3.1). So how would I do it there?

like image 693
hugo der hungrige Avatar asked Mar 25 '14 15:03

hugo der hungrige


1 Answers

It's possible to fix this with a simple JavaScript-Snippet:

function bsCarouselAnimHeight()
{
    $('.carousel').carousel({
        interval: 5000
    }).on('slide.bs.carousel', function (e)
    {
        var nextH = $(e.relatedTarget).height();
        $(this).find('.active.item').parent().animate({ height: nextH }, 500);
    });
}
like image 107
hugo der hungrige Avatar answered Oct 12 '22 23:10

hugo der hungrige