$('#cart > .heading a').bind('mouseenter', function() {
$('#cart').addClass('active');
$.ajax({
url: 'index.php?route=checkout/cart/update',
dataType: 'json',
success: function(json) {
if (json['output']) {
$('#cart .content').html(json['output']);
}
}
});
$('#cart').bind('mouseleave', function() {
$(this).removeClass('active');
});
});
我需要延迟mouseleave上的removeClass。我可以简单地添加一个this.delay行吗?Jquery延迟事件
有点建议:而不是mouseenter,mouseleave use .hover(...,...) – 2011-06-05 00:26:19