Javascript - Scriptaculous - 效果回调函数 [英] Javascript - Scriptaculous - Effect Callback function

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

问题描述

我正在使用 scriptaculous 使用以下代码执行滑动效果:

I am using scriptaculous to perform a slidedown effect using the following code:

Effect.SlideDown('dom_element_id');

然后我使用以下方法隐藏启动此效果的按钮:

I then hide the button which initiates this effect using:

$('button_id').hide();

问题是按钮在动画效果完成之前隐藏,我希望它在动画效果完成后隐藏.我找不到 Effect.SlideDown 的回调参数.

The issue is that the button is hidden before the animation effect is complete, I would like it to hide after the animation effect is complete. I could not find a callback parameter for Effect.SlideDown.

推荐答案

您可以通过 afterFinish 选项来传递一个回调,以便在效果完成后运行.

You can pass the afterFinish option to pass a callback to be run after the effect has been completed.

Effect.SlideDown('dom_element_id', { afterFinish: function () {$('button_id').hide(); } } );

编辑

注意beforeFinishafterFinishbeforeSetupafterSetupbeforeUpdateafterUpdate 选项可用于任何效果,因为它们是 Effect.Base 的一部分.

Note that beforeFinish, afterFinish, beforeSetup, afterSetup, beforeUpdate and afterUpdate options can be used for any effects as they are part of Effect.Base.

另请参阅此处的官方文档.

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

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