Javascript 如何在2sec'mouseenter'之后获取'morpha.start()'?

Javascript 如何在2sec'mouseenter'之后获取'morpha.start()'?,javascript,mootools,mouseenter,mootools-events,Javascript,Mootools,Mouseenter,Mootools Events,:如何在2secmouseenter之后获取morpha.start() window.addEvent('domready',function() { var morph = new Fx.Morph('resize',{duration:700,delay:400}); $$('#resize').addEvent('mouseenter',function(e){ e.stop(); morpha.start({ width: '200px',

:如何在2sec
mouseenter
之后获取
morpha.start()

window.addEvent('domready',function() {
var morph = new Fx.Morph('resize',{duration:700,delay:400});
$$('#resize').addEvent('mouseenter',function(e){
    e.stop();
    morpha.start({
        width: '200px',
        height: '100px'
    });
}//It does not work on adding ',2000' here
);

<div id="resize" class="resize">DIV will get bigger after 2sec on mouseenter</div>
window.addEvent('domready',function(){
var morph=new Fx.morph('resize',{duration:700,delay:400});
$$('#resize').addEvent('mouseenter',函数(e){
e、 停止();
开始({
宽度:“200px”,
高度:“100px”
});
}//在此处添加'2000'不起作用
);
在mouseenter上2秒后DIV会变大
使用延迟

范例


这也被重构为使用element.morph,它为您创建类实例-如果您在2秒钟的启动时间内鼠标移出,它将取消转换。

谢谢!我为
mouseleave
添加了
timer
。这样做很好吗?添加它很好,但在哪里取消它?我真的需要这样做吗?所以它不起作用-
document.id('resize').set("morph", {duration:700,delay:400}).addEvents({
    mouseenter: function(){
        this.store("timer", (function() {
            this.morph({
                width: '200px',
                height: '100px'
            });
        }).delay(2000, this));
    },
    mouseleave: function() {
        $clear(this.retrieve("timer"));
    }
});