Shp*_*ord 2 javascript jquery effects fade
所以我现在有这个:
$('#message_notice').click(function(){
$(this).fadeOut('slow');
});
$('#message_notice').delay(8000).fadeOut('slow');
Run Code Online (Sandbox Code Playgroud)
我最终要做的就是点击一条消息,然后继续淡出它.否则,在X秒内,自动淡出.
我可以做其中一个,但如果我有两个(如我的例子中)那么点击不起作用(只是延迟淡入淡出).
我正在使用jQuery 1.4.4.
您需要.stop(true)在单击处理程序中调用以取消delay()放入队列中的操作.
新代码应该是这样的
$('#message_notice').click(function(){
$(this).stop(true).fadeOut('slow');
});
$('#message_notice').delay(8000).fadeOut('slow');
Run Code Online (Sandbox Code Playgroud)