在显示新通知之前关闭之前的 jGrowl 通知

发布于 2024-08-11 08:36:48 字数 693 浏览 4 评论 0原文

我有一个执行 $.jGrowl("loading"); 的简单应用程序。然后,在处理数据后显示数据 $.jGrowl("blah blah blah data gone here");,这可能需要 1 -5 秒。

我看过一个 帖子 提到使用 default.pool 一次只显示一条消息。我想要的格式是:

  • 显示框1
  • 紧缩数据
  • 关闭框1
  • 显示框2

是否有一个jGrowl 功能可以启动以关闭所有通知?

更新
根据源示例,您可以执行以下操作
$('#loading').jGrowl('正在加载...');
然后调用关闭它
$('#loading').jGrowl('shutdown');

这确实隐藏了加载咆哮,但它也隐藏了该区域的后续通知。

I have a simple app that executes $.jGrowl("loading");. Then the data is displayed $.jGrowl("blah blah blah data goes here"); after crunching data which can take 1 -5 seconds.

I've seen a post that mentions using the default.pool to only display one message at a time. The format I want is:

  • Show box 1
  • crunch data
  • close box 1
  • show box 2

Is there a jGrowl function that can be initiated to close all notifications?

UPDATE
according to the source example you can do the folowing
$('#loading').jGrowl('<img src="images/loading.gif" alt="Loading..." />');
then call to close it
$('#loading').jGrowl('shutdown');
<div id="loading" class="top-right"></div>
that does hide the loading growl, however it also hide subsequent notifications in that region.

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

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

发布评论

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

评论(2

昔日梦未散 2024-08-18 08:36:48
$('#loadinggrowl').jGrowl('<img src="images/loading.gif" alt="Loading..." />');
$.jGrowl('content here');
document.getElementById('loadinggrowl').style.display = "none";

<body><div id="loading" class="top-right"></div></body>

上面的第3行在加载内容后隐藏了loadinggrowl div。

这可能不是最好的方法,但它确实有效。

$('#loadinggrowl').jGrowl('<img src="images/loading.gif" alt="Loading..." />');
$.jGrowl('content here');
document.getElementById('loadinggrowl').style.display = "none";

<body><div id="loading" class="top-right"></div></body>

Line 3 above hides the loadinggrowl div after loading the content.

this may not be the best way, but it works.

海的爱人是光 2024-08-18 08:36:48

您可以使用 $(".jGrowl-notification").each 查找所有通知,使用 .trigger('jGrowl.beforeClose') 触发关闭功能,然后创建您的通知新的咆哮声,如下所示:

$(".jGrowl-notification").each(function () {
    if ($(this).data("jGrowl") !== undefined && $(this).data("jGrowl").created !== undefined) {
        $(this).data("jGrowl").trigger('jGrowl.beforeClose');
    }
});
$.jGrowl("NEW MESSAGE");

You can find all notification with $(".jGrowl-notification").each, trigger the close fonction with .trigger('jGrowl.beforeClose'), and create your new growl, like below :

$(".jGrowl-notification").each(function () {
    if ($(this).data("jGrowl") !== undefined && $(this).data("jGrowl").created !== undefined) {
        $(this).data("jGrowl").trigger('jGrowl.beforeClose');
    }
});
$.jGrowl("NEW MESSAGE");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文