2010-07-10 2 views
0

Mootools : 2secmouseenter 뒤에 morpha.start()을 얻는 방법?Mootools : 2 초`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> 

고마워요!

답변

1

지연 사용.

http://www.jsfiddle.net/dimitar/m6JKt/이 또한 당신의 클래스 인스턴스를 수행하는 element.morph를 사용하는 리팩토링 된

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

예 - 당신이 기간 은혜를 시작 2 초 이내에로 마우스 경우는 전환을 취소합니다.

+0

고마워요! 'mouseleave' http://www.jsfiddle.net/hnmJa/에'timer '를 추가합니다. 잘 했니? – Binyamin

+0

추가하는 것이 좋습니다. 그러나 어디에서 취소합니까? –

+0

정말해야합니까? 그래서 작동하지 않습니다 - http://www.jsfiddle.net/hnmJa/1/ – Binyamin

관련 문제