我有一個圖標,當我把鼠標懸停在它上面顯示一個鏈接的div。用戶應該能夠點擊此鏈接,但當鼠標離開圖標時,它會消失。有誰知道我可以如何防止這種情況發生?Div與鏈接消失之前,我可以使用它(jQuery的隱藏/顯示)
代碼:
$('.div1').hover(function(e){
e.preventDefault();
e.stopPropagation();
$(this).next().show('fast');
},
function(e){
e.preventDefault();
e.stopPropagation();
$(this).next().hide('fast');
});
我做了一個的jsfiddle,藉以說明問題: