2013-04-13 36 views

回答

2
$(function() { 
    $('#box').on('mouseenter mouseleave', function() { 
     $(this).stop().fadeToggle(); 
    }); 
}); 

FIDDLE

+0

這是個竅門,對我來說是最好的解決方案。 –

+0

是的,這是更智能的解決方案 –

1

試試這個:

$(function() { 
    var box = $('#box'); 
    box.hover(function() { 
     $(this).fadeOut(500); 

    }, function() { 
     $(this).stop().fadeIn(500); 

    }); 
}); 

看到這個fiddle

+0

這並獲得成功。但下面的答案也做到了。 –