Closed PranKe01 closed 6 years ago
I don't know if you still need help with this, but maybe it'll help someone else. I was able to get it to close by with the following code (closes on click):
var notify = new PNotify({ ... });
// Close desktop notification on click
notify.get().click(function() {
notify.desktop.close();
});
@jshah4517 : How can we close the notification in react?
@satejrajam30 thanks for catching this issue. This was actually an issue with the React package, not the PNotify library. I've since fixed it and you should be able to simply update react-pnotify to see that changes working.
Patched in PR#2: https://github.com/zhuber/react-pnotify/pull/2
Hi, I'm still facing an issue with closing the pnotify notification. I'm using bootstrap3 for styling.
My closer button looks like this:
I have a function called displayErrorMessage = function(msg){ var error = new PNotify({
}); }.
outside this function, in the same file, i have another function called eventTriggers. within this function, I have written: var errorMsg = nx.common.displayErrorMessage(); $('.ui-pnotify-closer*').click(function(){ errorMsg.remove(); });
My main aim is to remove the notif upon clicking the 'X' button. I've read some places that if you have history attribute in the PNotify instantiation, then closing the button may not work. I'm not entirely sure though, can someone help me with this.
Thanks!
Hi, I want to close a desktop notification when I click on it. How can I do that?
Here is my "shortened" code:
` new PNotify({ delay: 8000, desktop: { desktop: true, tag: uniqueTag } }).get().click(function (e) { if ($(e.target).is('.ui-pnotify-closer, .ui-pnotify-sticker, .ui-pnotify-closer , .ui-pnotify-sticker ')) { return; }