2010-12-22 105 views
2

我試圖在用戶將鼠標懸停在文章上時顯示/隱藏博客文章的疊加層。我有hoverIntent工作,因爲它應該在mouseover上延遲事件,但是我希望mouseout事件立即發生,因爲它沒有hoverIntent。據我所知,無法爲超出和超出事件設置單獨的timout值。有人知道如何分開它們,或者如何讓hoverIntent只延遲over事件?使用hoverIntent延遲鼠標懸停但不是鼠標移出

$(document).ready(function() {  
    $(".bg-overlay").hide(); 

    $(".bg-entry").hoverIntent({ 
     over: showSummary, 
     timeout: 650, 
     out: hideSummary 
    }); 
}); 

function showSummary(){ $(this).children(".bg-overlay").fadeIn("fast"); } 
function hideSummary(){ $(this).children(".bg-overlay").fadeOut("fast"); } 

感謝您的幫助。

回答

3

超時是出函數之前的延遲被稱爲 - 只需將其設置爲0。

或者,撥打hoverIntent爲:

$(".bg-entry").hoverIntent(showSummary, hideSummary); 
+0

我完全誤解了。謝謝! – 2010-12-22 18:26:29