문제

mootools : 2sec morpha.start() 후에 mouseenter를 얻는 방법

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>
.

도움이 되었습니까?

해결책

지연을 사용합니다.

http://www.jsfiddle.net/dimitar/m6jkt/ 예제

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"));
    }
});
.

이것은 또한 Class 인스턴스를 수행하는 요소를 사용하기 위해 리팩토링되었으며 2 초 내에 마이크로 아웃하는 경우 전환을 취소합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top