Is there a way to assign a callback before the fade animation occurs in fadeToggle? I am adjusting scroll positions and would like to adjust it before the object appears, not after.
问问题
1759 次
3 回答
1
Call back gives you a way to perform something after the given action has completed. If you need to do something before operation (fading) just do it before calling the function itself.
于 2011-02-25T15:09:16.850 回答
1
would the fadeToggle
override be an option for you ? if so then click the link below :)
于 2011-02-25T15:09:45.923 回答
0
你需要做的就是在fadeToggle之后直接调用你的函数,或者运行任何代码:
element.fadeToggle('fast');
element.scrollTop(300);
这将立即设置滚动位置,然后淡入淡出效果。
这是我特别拥有的:可见和隐藏是我刚刚命名为 vars 的元素。
visible.fadeToggle('fast', function() {
hidden.fadeToggle('fast');
hidden.scrollTop(top_value);
});
当 visible 被隐藏时,回调被调用并且隐藏的元素变得可见。滚动位置是在之后立即设置的,因此您可以在淡入淡出完成之前看到更改。这样你就有了一个流畅的淡入淡出并保持两个元素的滚动位置相同。
于 2011-02-25T15:20:53.197 回答