2012-01-22 23 views
0

我正在使用pixastic庫爲圖像(表格)添加模糊效果。桌子上的物品也具有相同的效果(它們具有相同的類別&在具有該類的元素上正在調用pixastic模糊效果)。當鼠標在兩個元素之間移動時鼠標懸停效果會中斷

但是,當鼠標在元素之間移動時,效果消失1毫秒&然後出現,不用說,這看起來很糟糕。 table with blouses

在上表中,模糊像素效果應用於表格上的三件襯衫&。當鼠標從一個元素(比如表格)移動到另一個元素時,模糊效果會中斷(僅一瞬間)。

這裏是我的代碼:

// class .cItemsOnTable is elements which need to be blurred 
$(document.body).on("mouseover", ".cItemsOnTable", function (event) { 
    /* as the blur effect is suppose to simulate eye focus, 
     I use pixasticRevert func. to revert the blur effect 
     on other elements when mouse hovers over elements with 
     class cItemsOnTable */ 
    pixasticRevert(); 
    var modelWearArray = $(".cModelWear"); 
    /* modelWearArray is the other elements which receive blur 
     effect if mouse is not hovering over class cItemsOnTable */ 
    $(modelWearArray).each(function() { 
     $(this).addClass("cBlur"); 
     pixasticBlur(); 
    } 
}).on("mouseleave", ".cItemsOnTable", function (event) { 
    pixasticRevert(); 
    var itemsOnTableArray = $(".cItemsOnTable"); 
    $(itemsOnTableArray).each(function() { 
     $(this).addClass("cBlur"); 
    }); 
    pixasticBlur(); 
}); 
+0

你能提供一個實例或至少一些html代碼嗎?你嘗試過「mouseenter」而不是「mouseover」嗎? – ori

+0

@ori,我有。我不能提供現場示例,因爲我懷疑jsfiddle支持pixastic庫 – Kayote

回答

0

有jQuery中2對事件 - mouseenter/mouseleavemouseover/mouseout。閱讀他們的文檔,並選擇適合您需求的文檔。另外,你在代碼中混合了mouseovermouseleave(除非出於某種原因,這是故意的)。

+0

謝謝,實際上我使用的是mouseenter/mouseleave,但用mouseover替換它只是爲了測試。代碼可以很好地運行。 我也嘗試刪除HTML代碼之間的空白,這也沒有幫助。我正在尋找如何將JSfiddle上的代碼作爲審查的示例。 – Kayote

相關問題