fabien-d / alertify.js

JavaScript Alert/Notification System
http://fabien-d.github.com/alertify.js/
4.26k stars 726 forks source link

Added function to close notification immediately from anywhere #239

Open tobiasc opened 10 years ago

tobiasc commented 10 years ago

Added function to close notification immediately from anywhere, this is using the className attribute. I created it without changing the code significantly, I tried to only add code.

Here's an example of how to use it:

// display notification that stays forever alertify.log(, , 0);

// close notification from some event handler $('#id').click(function () { alertify.closeNow(); });

Kambaa commented 7 years ago

Not working with your given explanation. However it works like this..

var testAlertifyVar = alertify.log("Will stay until clicked", "", 0);
        $('#closeFromApiTest').on('click',function(){
            testAlertifyVar.closeNow("show");
        })

show parameter is the last part of the classname of an opened notification. (alertify-log-show's show part) This way all of the opened notification closes(Haah, so much more features needed in this project... Owner, where are you??? please come back... :) )