2012-12-28 27 views
0

我有此位的jQuery:jQuery的 - 在鉻的mouseenter工作,但在Firefox中沒有

$('#list_cont').on('mouseenter', '.show_map', function() { 
    $(this).next('.map_cont').stop().fadeIn(800); 
}).on('mouseleave', '.show_map', function() { 
    if (!$(this).next('.map_cont').is(':hover')) { 
     $(this).next('.map_cont').delay(600).stop().fadeOut(800); 
    } 
}); 

$('#list_cont').on('mouseenter', '.show_map', function() { 
    $(this).stop().show(); 
}).on('mouseleave', '.map_cont', function() { 
    $(this).delay(600).stop().fadeOut(800); 
}); 

這表明.map_cont.show_map了mouseenter,那麼如果在.map_cont盤旋,它沒有淡出,直到光標離開.map_cont

這適用於chrome,但不適用於Firefox。我不知道如何跨瀏覽器測試這種類型的東西。

回答

0

由於.map_cont位於#list_cont之內,因此如此。所以,你需要這樣定義你的功能:

$('.map_cont').on('mouseleave', '.show_map', function() { 
    if (!$(this).next('.map_cont').is(':hover')) { 
     $(this).next('.map_cont').delay(600).stop().fadeOut(800); 
    } 
}); 
相關問題