【问题标题】:jQuery Cycle - two animations in one cyclejQuery Cycle - 一个循环中的两个动画
【发布时间】:2011-01-16 13:53:00
【问题描述】:

我用 jQuery Cycle 制作了幻灯片,但是我的计时器有问题。几个周期后,他们搞砸了。如何在一个函数和一个计时器中合并两个循环动画?

感谢您的帮助。

xHTML:

<div id="slideshow">
  <ul>
    <li>
      <div class="image"><img src="test.jpg" /></div>
      <div class="description">Some text goes here</div>
    </li>
    <li>
      <div class="image"><img src="test.jpg" /></div>
      <div class="description">Some text goes here</div>
    </li>
    <li>
      <div class="image"><img src="test.jpg" /></div>
      <div class="description">Some text goes here</div>
    </li>
  </ul>
</div>

jQuery:

var img = $(this).find('#slideshow div.image');
var desc = $(this).find('#slideshow div.description');
$('#slideshow ul').cycle({
    fx:    'scrollHorz', 
    speed:  'fast', 
    timeout: 5000,
    next:   '.next',
    pause: 1,
    slideExpr: img
});
$('#slideshow').cycle({
    fx:    'scrollVert', 
    speed:  'fast', 
    timeout: 5000,
    next:   '.next',
    pause: 1,
    slideExpr: desc
});

【问题讨论】:

  • 您找到解决方案了吗...?寻找相同的。

标签: jquery animation cycle effect jquery-effects


【解决方案1】:

我认为你应该:

  1. 为时间处理问题制作您自己的自定义函数(一个相当简单的 JS 函数就可以解决问题)。
  2. 将周期中的“超时”属性设置为 0,这样它就不会自动跳转。
  3. 以这种形式在您的自定义函数中使用可用的命令“prev”和“next”:

$('#slideshow').cycle('next');

我在您的代码中看到了这种方法,非常感谢您刚刚给我的好主意。

【讨论】:

  • 你能解释一下吗... ulo 所说的幻灯片工作正常,但我如何使用寻呼机??
猜你喜欢
  • 1970-01-01
  • 2012-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多