gpt4 book ai didi

javascript - Noty.js 在新通知上删除最旧的通知

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:06:04 25 4
gpt4 key购买 nike

我正在使用这个脚本 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 关闭它。 :)

关于javascript - Noty.js 在新通知上删除最旧的通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22346532/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com