Bootstrap 3 Carousel上的动画高度变化 [英] Animate height change on Bootstrap 3 Carousel
问题描述
在研究如何在Bootstrap 3 Carousel上设置高度变化动画这个问题时,我找到了这个答案,但它对我的引导转盘没有任何影响。我还不能发表评论并要求澄清,因此有一个新问题。
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.
解决方案建议有
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);
});
}
但正如我所说,没有任何影响。也许我应该在我的情况下修改Javascript中的任何选择器?
But as I said, without any effect. Maybe I should modify any selectors in the Javascript in my case?
我更新了小提琴,所以它实际上显示了问题。
I updated the fiddle so it's actually showing the problem.
全部我很感激!谢谢。
推荐答案
您的代码没问题。你只是没有在任何地方调用函数bsCarouselAnimHeight()
,所以它都没有被触发。
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.
< a href =http://jsfiddle.net/4HDBe/4/ =noreferrer> http://jsfiddle.net/4HDBe/4/
这篇关于Bootstrap 3 Carousel上的动画高度变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!