كيفية الحصول على مورفا.بداية () 'بعد 2 ثانية 'ماوس سنتر'?
-
13-09-2020 - |
سؤال
موتولز:كيفية الحصول على morpha.start()
بعد 2 ثانية 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"));
}
});
كما تم إعادة بناء هذا لاستخدام العنصر.مورف الذي لا مثيل الطبقة بالنسبة لك-وسوف إلغاء الانتقال إذا كنت الماوس في غضون 2 ثانية تبدأ فترة نعمة.
لا تنتمي إلى StackOverflow