javascript - jQuery Cycle 插件 - 容器的自动高度

标签 javascript jquery jquery-cycle

我正在使用 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/

相关文章:

javascript - jQuery 周期 2 : pause slideshow on click

javascript - 如何使用 JQuery 淡入图像变化

javascript - 如何完全停止运行 jQuery 循环函数(不是暂停/恢复)

javascript - 如何通过单击更改/交换 div 的背景图像?

javascript - 我的 javascript 代码有什么错误?

javascript - facebook 分享对话框重定向而不是弹出?

javascript - 从包含多个数字的字符串中提取特定数字

JavaScript 类和变量作用域

jquery - 无法使用 jQuery 和 CSS3 正确交叉淡入淡出图像?

javascript: 点击 table1 列幻灯片显示 table2 列