3

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?

Jim G.
  • 15,141
  • 22
  • 103
  • 166

3 Answers3

8

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.

Bruno De Barros
  • 1,535
  • 2
  • 16
  • 30
2

$.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. :)

Ceejay
  • 21
  • 1
1

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.

JoshJordan
  • 12,676
  • 10
  • 53
  • 63