jGrowl:如何将我的界面一次限制为一条消息?

发布于 2024-08-02 14:52:28 字数 96 浏览 6 评论 0原文

鉴于:我在页面加载时加载消息队列。

使用 jGrowl,我如何以滴水般的方式显示每条消息,一次一条消息?

Given: I load a queue of messages at page load.

With jGrowl, how can I display each message, one message at a time, in a drip-like fashion?

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

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

发布评论

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

评论(3

小女人ら 2024-08-09 14:52:28

几个月前,我需要为一个项目执行此操作。如果您使用最新的 jGrowl(截至撰写本文时为 1.2.0)中提供的池功能,您可以简单地编写:

$.jGrowl.defaults.pool = 1;

这样,您可以同时加载所有这些,jGrowl 将只在以下位置显示一个:一次。当一条消息关闭时,jGrowl 将自动显示下一条消息。

我希望这就是你想要的。

I needed to do this for a project, a few months ago. If you use the pooling feature, available in the latest jGrowl (1.2.0 as of this writing), you can simply write:

$.jGrowl.defaults.pool = 1;

That way, you can load all of them at the same time, jGrowl will take care of only showing one at a time. When a message closes, jGrowl will automatically display the next one.

I hope this is what you wanted.

抱猫软卧 2024-08-09 14:52:28

$.jGrowl.defaults.pool == 0;

if ( $(this.element).find('div.jGrowl-notification:parent').size() < 0 ) {

目前正在处理站点通知,我找不到一种一次显示一个通知的方法,直到我找到了这个页面。
谢谢布鲁诺!你救了我。 :)

$.jGrowl.defaults.pool == 0;

if ( $(this.element).find('div.jGrowl-notification:parent').size() < 0 ) {

Currently working on site notifications, I couldn't find a way to show one at a time until I found this page.
Thanks Bruno! You saved me. :)

小清晰的声音 2024-08-09 14:52:28

由于您指定了消息显示的时间间隔(最大),因此您可以简单地使用 JS setTimeout 以相同的时间间隔循环遍历数组,创建一条新消息。

或者,jGrowl 可以将函数(e,m,o) 作为其 close 参数,并且每当消息关闭时它将使用它作为回调。在此函数中,从队列中创建一条新消息,然后您就应该完成设置。请参阅文档此处

Since you specify the time interval that a message is displayed for (at maximum), you could simply use a JS setTimeout to loop through an array at the same interval, creating a new message.

Alternatively, jGrowl can take a function(e,m,o) as its close parameter, and it will use it as a callback whenever a message is closed. In this function, create a new message from your queue and you should be set. See documentation here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文