jQuery动画函数回调 [英] jquery animate function callback

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

问题描述

我有一个带有jQuery动画功能,并且没有触发回调,我认为另一双眼睛很快就会变得很简单.这是代码:

I have a jquery animate function with a callback that isn't firing, I think it's something simple that another pair of eyes will pick up quickly. This is the code:

$('#base_back_img').animate({
  width:372,
  height:389,
  marginLeft:0,
  paddingTop:0,
  marginTop:1
}, {duration:300, queue:false},
  function() {
   $('#menu-text').css({
     display:'block'
   });     
   $('#mini-menu').fadeOut();
 });

推荐答案

在使用带有对象的动画作为参数时,您需要像这样使用complete:

When using animate with an object as argument, you need to use complete just like that :

$('#base_back_img').animate({
    width:372,
    height:389,
    marginLeft:0,
    paddingTop:0,
    marginTop:1
}, {duration:300,
    queue:false,
    complete : function() {
        $('#menu-text').css({
            display:'block'
        });     
        $('#mini-menu').fadeOut();
    }
});

在此处查看所有属性: http://api.jquery.com/animate/#animate-properties-options

See all properties here : http://api.jquery.com/animate/#animate-properties-options

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

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