我正在使用此脚本http://ned.im/noty/
用于显示通知
var n = noty({
text: message,
type: type,
dismissQueue: true,
force: true,
layout : "bottomLeft",
theme: 'newTheme',
maxVisible : 5
});
所以这是当前配置,它已排队5个项目。问题是,当单击按钮时,我不知道如何删除显示新通知时的第一个通知。
任何想法都欢迎。
最佳答案
好的,我使用noty.js API找出了答案:http://ned.im/noty/#api
首先,我定义了顶部通知
var notyclose_id = $("#noty_bottomLeft_layout_container>li:first-child>.noty_bar").attr('id');
之后,我得到通知的数量
var noty_list_count = $("#noty_bottomLeft_layout_container li").size();
我会检查此金额是否大于或等于我的通知设置
if(noty_list_count >= 5)
$.noty.close(notyclose_id);
如果是,我使用api将其关闭。 :)