【问题标题】:JQuery, Starting a function again. . . . ? animation-queueJQuery,再次启动一个函数。 . . . ?动画队列
【发布时间】:2013-08-16 13:30:04
【问题描述】:

好的,下面是主要功能:

function updown(){
  var bottom = $(document).height()-$(window).height();
  //scroll to bottom. scroll to 0. and execute updown().
  $('body')
    .animate({scrollTop:bottom},20000)
    .animate({scrollTop:0},2000,updown);
}
updown();

然后我正在使用:

$('body').stop(true);

点击按钮停止动画队列

我的问题是如何重新启动动画队列? 所以例如$('body').play(true);,如果你明白我在说什么(虽然我知道它没有那么简单,哈哈)。 . .

提前感谢您的任何帮助!

【问题讨论】:

标签: javascript jquery function animation queue


【解决方案1】:

你试过再次调用 updown() 吗?

【讨论】:

  • 据我所知,他需要一些暂停和恢复
  • @MCSenstrum,请解释更多细节。如果这是评论,请添加为评论。
【解决方案2】:
<button id="go">Go</button>
<button id="stop">STOP!</button>

function updown(){
 ...
}

updown();

/* Stop animation */
$("#stop").click(function(){
    $(".body").stop();
});

/* Start animation */
$("#go").click(function(){
    updown();
});

更多信息:http://api.jquery.com/stop/

【讨论】:

  • 无论出于何种原因调用 updown();功能再次不起作用我不知道为什么我已经尝试过它并且它不起作用,也许它可能是我正在使用的程序〜Edge animate。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-09-29
  • 1970-01-01
  • 2016-09-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多