如何显示 jgrowl 通知的数量?

发布于 2024-09-05 16:38:51 字数 154 浏览 2 评论 0原文

我正在使用 5 个 jquery 池。因此只应显示 5 条通知。我认为最好在“关闭全部”按钮下显示如图所示的 20 条通知中的 5 条的计数。

对我来说,如果我不断关闭通知而新通知不断弹出,可能会让人感到困惑。我可能认为该网站存在某种问题。

有人知道该怎么做吗?

I am using a pool of 5 with jquery. So only 5 notifications should be shown. I think it would be nice to have maybe under the "close all" button to have a count like shown 5 of 20 notifications.

To me it could get confusing if I keep closing notifications and new ones keep poping up. I might think there is some sort of problem with the site.

Anyone know how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心是晴朗的。 2024-09-12 16:38:51

您可以在全局变量中存储打开通知的数量,并通过 jgrowl 事件中调用的自定义函数来增加/减少/显示它:beforeOpen/openbeforeClose/关闭 即:

var opened = 0;

function counter(i)
{
    opened += i;
    $('#closeAllContainer span.counter').text(opened);
}

$.jGrowl("Lorem Ipsum", {
    beforeClose: function(){ counter(-1); },
    beforeOpen:  function(){ counter(1); }
});

You can store number of open notifications in global variable and increase/decrease/display it by custom function called in jgrowl events: beforeOpen/open and beforeClose/close ie:

var opened = 0;

function counter(i)
{
    opened += i;
    $('#closeAllContainer span.counter').text(opened);
}

$.jGrowl("Lorem Ipsum", {
    beforeClose: function(){ counter(-1); },
    beforeOpen:  function(){ counter(1); }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文