Animate height change on Bootstrap 3 Carousel

╄→гoц情女王★ 提交于 2019-12-07 04:15:36

问题


On researching the question "How to animate height change on Bootstrap 3 Carousel" I found this answer, however it doesn't have any effects on my bootstrap carousel. I can't comment yet and ask for clarification there, therefore a new Question.

The solution suggested there is

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);
});
}

But as I said, without any effect. Maybe I should modify any selectors in the Javascript in my case?

Update:

I updated the fiddle so it's actually showing the problem.

All ideas are appreciated! Thanks.


回答1:


Your code is fine. You're just not calling function bsCarouselAnimHeight() anywhere so none of it is firing.

You can either take it out of the function declaration

http://jsfiddle.net/4HDBe/3/

or call the function at some point.

http://jsfiddle.net/4HDBe/4/



来源:https://stackoverflow.com/questions/23564447/animate-height-change-on-bootstrap-3-carousel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!