开始执行动画的回调函数(完成)? [英] animate's callback function (complete) executed at start?

查看:222
本文介绍了开始执行动画的回调函数(完成)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery 1.5.1,这是我的代码:

I'm using jQuery 1.5.1 This is my code:

$('.cellcontent').animate({
   left: '-=190'}, {
   easing: alert('start ani'),
   duration: 5000,
   complete: alert('end ani')});

在动画开始之前,我会收到两个警报!?我希望完整的功能在动画结束后开始。有什么想法吗?

I get both alerts before the animation starts!? I want the complete function to start after the animation has ended. Any thoughts?

推荐答案

您需要传递一个函数来调用。相反,您正在调用该函数。

You need to pass a function to call. Instead you are calling the function.

complete:  function() { alert('end ani'); } 

这篇关于开始执行动画的回调函数(完成)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆