所以我有这个代码在AJAX请求之后在print_info()函数中调用; click()事件jquery
'print_info' : function(message,type) {
$('.load').hide();
$('<div>'+message+'</div>').insertAfter('#loader').addClass('autoHideBox '+type).fadeIn("slow").delay(2000).fadeOut("slow", function() { $(this).remove(); });
},
正如你可能会看到,在div消失在几秒钟之内的了,我的问题是,即使我添加以下代码:
.click(function() { $(this).fadeOut("slow", function() { $(this).remove(); }); })
的DIV不会淡出/删除在所有。你能清除这个吗?因为我对这件事有点困惑。
问候, Duluman艾迪
后来编辑:
我得到了它。对工作( “点击”,回调),但尽管如此,逐渐把它隐没在回调中取出只是不会工作。因此,为了让它工作,所以你可以做任何你需要做的事情在on(“click”的回调中,只需在.on()之前添加,stop(true,true).on(“点击”,回调);
'print_info' : function(message,type) {
$('.load').hide();
$('<div>'+message+'</div>')
.insertAfter('#loader')
.addClass('autoHideBox '+type)
.fadeIn("slow")
.delay(2000)
.fadeOut("slow", function() { $(this).remove(); })
.on('click', function() {
$(this).stop(true,true).fadeOut("slow", function() { $(this).remove(); })
});
},
简单的回调,但为了解决这个问题回调,只需插入.stop(真的, true)之前.on(“click”,回调),在第一篇文章中编辑,以便其他人也可以看到。 – Eduard 2012-03-23 15:21:50