简体   繁体   中英

JQX Notification Widget showing multiple messages

Currently I am using jqx notification widget where a click on a button below code executes. But the problem is it displays multiple messages when we click on a button. I want to restrict it to single notification when we click on that button. Once it fades and the user clicks on that button it should display that message.

$('#dialog').after("<div id = 'jqxNotification' style='display: none;'>Saved Successfully.</div>");
$("#jqxNotification").jqxNotification({ width: 250, position: "top-right", opacity: 0.9,
        autoOpen: true, animationOpenDelay: 800, autoClose: true, template: "success"
});

Here's some tips

There's no any setting for to do this, but what you can do is
before open showing notification hide all previous all notification by property .jqxNotification("closeAll")

function showMessage() {
   $("#jqxNotification").jqxNotification("closeAll");
   $('#dialog').after("<div id = 'jqxNotification' style='display: none;'>Saved Successfully.</div>");

   $("#jqxNotification").jqxNotification({ width: 250, position: "top-right", opacity: 0.9,
        autoOpen: true, animationOpenDelay: 800, autoClose: true, template: "success"
   });
}

showMessage()
setTimeout(showMessage,1000);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM