我有這樣的腳本:jQuery的延遲鼠標移出
$("#menu ul li").mouseover(
function() {
$(this).find(".submenu").fadeIn("slow");
}
);
var timer = 0;
function animate_me() {
$(this).find(".submenu").stop().fadeOut("slow");
}
$(function(){
$("#menu ul li").mouseout(function(){
timer = setTimeout("animate_me()", 300); // start timer when mouse is moved in
}, function() {
clearTimeout(timer); // stop it if mouse is moved out
});
});
我如何延緩淡出,直到菜單UL裏已經打探過兩秒鐘?
延遲只會延遲淡出 - 我需要它停止函數,如果再次註銷 – maccaj51 2012-02-07 12:43:25
如果您使用true作爲第一個參數在'.stop()'它停止延遲也...試試演示... – meo 2012-02-07 12:46:55