我正在使用 cycle plugin在一些 div 上,像这样:
<div class="sections">
<div class="Section"> <img /> text </div>
<div class="Section"> <img /> text </div>
<div class="Section"> <img /> text </div>
</div>
所有的 .section div 都有可变的高度,基于它们的内容。 我怎样才能使循环不将容器 div(部分)的大小调整为最大的子高度?相反,我希望容器将每个动画的大小调整为当前的子高度。
最佳答案
好的,我设法通过在“after”事件上 Hook 一个函数来做到这一点:
function onAfter(curr, next, opts, fwd) {
var $ht = $(this).height();
//set the container's height to that of the current slide
$(this).parent().animate({height: $ht});
}
在这里找到信息: http://forum.jquery.com/topic/jquery-cycle-auto-height
关于javascript - jQuery Cycle 插件 - 容器的自动高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3203516/