2012-11-12 62 views
0

您好我有這樣的代碼,它不工作,我不明白爲什麼的mouseenter JavaScript的工作不

$('#thumbs > li').mouseenter(function() { 
    $(this).find("div").fadeIn(); 
}).mouseleave(function(){ 
    $(this).find("div").fadeOut(); 
}); 
​ 

這裏是整個事情http://jsfiddle.net/8Q24N/

+0

'not working' ...非常具有描述性,如果您不打算正確設置它,發佈小提琴又有什麼意義? – Musa

+0

你是什麼意思,正確設置? –

+0

什麼應該是標題,如果它不工作,相同的代碼在這裏工作http://jsfiddle.net/wdAzE/8/ –

回答

0

你可能想這

$(document).ready(function(){ 
    $('#thumbs > li').mouseenter(function() { 
     $(this).find("div").fadeIn(); 
    }).mouseleave(function(){ 
     $(this).find("div").fadeOut(); 
    }); 
});​ 

將代碼包裝在$(document).ready(function(){...})

DEMO

+0

知道了謝謝你,先生親切 –

+0

@behzad_b,不客氣:-) –

+0

有沒有什麼辦法可以讓我有兩個

bzzz
和一個
Dezz
。 ONe在屏幕左側的圖片右側,同時顯示 –