与回调jQuery的动画显示/隐藏(不希望它) [英] jQuery show/hide with callback animates (dont want it)

查看:114
本文介绍了与回调jQuery的动画显示/隐藏(不希望它)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我添加的回调显示/隐藏,我的元素开始动画。我不希望它。我只需要后显示/隐藏完成增加一个功能。

,我不能抵消时间,因为我使用基于选项功能(元素可以是动画,但如果它不想要的,它必须只显示隐藏随着连接到它的回调,这是行不通的。(

有一个巧妙的方法来elliminate上显示/隐藏动画?
或者是有另一种方式来增加功能后的动画已完成?

在此先感谢!

找到了解决办法!只要做到:

 显示('','',()的函数...


解决方案

文档

  .show([时间] [,宽松] [回调])

要专门禁用动画,设置它的持续时间为零,也没有宽松:

  .show(0,'',函数(){
    //你的code在这里
});

When I add callback to show/hide, my element starts to animate. I dont want it. I just need to add a function AFTER show/hide is finished.

I cannot nullify time, cause i use option-based function (element CAN be animated, but if its not wanted, it must just show-hide. With callback attached to it, it does not work :(

Is there a neat trick to elliminate animation on show/hide? OR is there another way to add a function AFTER animation has finished?

Thanks in advance!

Found the solution! Just do:

show('','', function()...

解决方案

From the documentation:

.show( [duration] [, easing] [, callback] )

To specifically disable the animation, set it's duration to zero and no easing:

.show(0,'', function(){
    //your code here
});

这篇关于与回调jQuery的动画显示/隐藏(不希望它)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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