-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i Limit a alert. #136
Comments
Like you only want to show one alert of different content at a time? |
I think both me and @dineshpandianr want the same thing - option to set the maximum number of alerts displayed simultaneously, in other words - ability to limit the number of notifications on the screen at any given time. The oldest visible notification would be removed in favour of the new one. |
I am working on adding this because I need it for a project I am working on.
|
+1 $.notifyClose();
$.notify({...}); But since the new notification appears before the old one is done animating out it ends up being below. On the other hand, doing that with |
Just to be clear, in the new version it doesn't really limit 1 notification but queues them on one of two options, queue and restrict. Where queue will only show a specific number, once one of them closes it will show the next notification in the queue. Restrict will force close the oldest notification to show the newest one called. This still plays the animations associated with the queue. I could say if on restrict the exit animation doesn't play? That may work... not sure. |
I guess that's ok. In my specific case I only want one notification at a time because it's the I think your queue and restrict approach is perfectly fine. I don't think On 31 March 2016 at 15:02, Robert McIntosh [email protected] wrote:
|
Why don't you use the update feature instead of creating new notifications? |
@mouse0270 I've missed that completely. Anyway I don't save the $.notify reference and even if I did I'd have to check whether it's active to update it or if it's not show a new one. Too much logic. I'm fine with how it's now. |
@emzero I think there's an 'allow_duplicates' option , which when set to false, result in Notify checking whether the new notification is a duplicate and not showing it if it is. |
@mouse0270 Thanks for the updates but can you tell us where is documentation of "queue and restrict" ? Same need, I would like to restrict to few notification at a time. |
Has this been fixed already? |
The queue and restrict is part of the new version. I finally finished my other work, that I started working on this again last weekend. I am hoping to release it tomorrow. |
Hello, |
Any news about this feature ? Thanks. |
I dont want to assault my users with all old notifications every time a new notification is displayed. It looks like I can use update to change the message, type, etc. But since I am recycling the same notification, how do I make it visible again? Thanks for any help. |
@mouse0270 I have a project where we'd like to queue and show one notification at a time; trying to mimic Material UI's snackbar. Is there any update on the queue/restrict functionality? |
I have created a pull request for this feature: #186 If you place notifications to the top, I suggest to you to use it the following way.
|
The above pull request has not been merged yet, however, I did find a work around for anyone else who stumbles upon this. This solution does not modify the existing code base, which means you are safe if a new version is created or you are using composer as a dependency manager (which is what I am doing). The solution is to store the notification in a variable
Then before you create it, check if it exists. I am using JQueries length() function.
There is a downfall to this. I am using Fortawesome 5 icons (svg based) and when you do an update, the icon disappears. I had to remove it. ^ Edit: This only occurs when the icon is within the same element marked as data-notifiy="title"
Work around..
I have also tried destroying the notification, which doesn't work because the new notification gets created before the old one is destroyed causing it be created below the currently existing one. |
For one alert: Give a class to notify div element in template setting and remove it before notify. Like this:
|
I need only one alert
The text was updated successfully, but these errors were encountered: