gpt4 book ai didi

javascript - Mootools 等待 Fx.Morph 启动

转载 作者:行者123 更新时间:2023-12-02 18:30:26 27 4
gpt4 key购买 nike

我正在尝试让 vareffect = new Fx.Morph(testMorph, {) 在开始之前等待/延迟 2 秒。
( fiddle here )

但是当我尝试 .wait(2000).delay(2000),甚至 .wait(2000,effect) 我get 未捕获类型错误:对象 [object Object] 没有方法“延迟”

有什么想法可以让它发挥作用吗?

我正在使用的代码:

var testMorph = document.id('testMorph');
var effect = new Fx.Morph(testMorph, {
transition: 'back:out',
duration: 900,
link: 'chain'
}).start({
'top': 20,
'opacity': 1
}).start({
'border-color': '#A80025',
'color': '#A80025'
});
effect.delay(2000);

最佳答案

您可以结合使用chain()delay()来达到所需的效果。

new Fx.Morph(testMorph, {
transition: 'back:out',
duration: 900,
link: 'chain'
}).start().chain(function(){
this.start.delay(2000,effect,{
//first
});
}).chain(function(){
this.start({
//second
});
});

chain() 在当前效果的末尾添加另一个效果。第一个效果只是 start() 和一个空效果,为我们的事件链提供上下文。

然后使用 start.delay() 方法将其链接到延迟事件(delay()Function 的属性)。

这又与你的其他效果相关。

参见here .

关于javascript - Mootools 等待 Fx.Morph 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17854283/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com