`;
h += `
${html_encode(options.title)}
`;
@@ -42,6 +42,9 @@ function UINotification(options){
const el_notification = document.getElementById(`ui-notification__${window.global_element_id}`);
+ // now wrap it in a div
+ $(el_notification).wrap('
');
+
$(el_notification).show(0, function(e){
// options.onAppend()
if(options.onAppend && typeof options.onAppend === 'function'){
@@ -50,6 +53,12 @@ function UINotification(options){
})
$(el_notification).on('click', function(e){
+ // close button clicked
+ if($(e.target).hasClass('notification-close')){
+ return;
+ }
+
+ // click event
if(options.click && typeof options.click === 'function'){
options.click(options.value);
}
@@ -62,10 +71,6 @@ function UINotification(options){
$(document).on('click', '.notification', function(e){
if($(e.target).hasClass('notification')){
- // TODO: options isn't available here
- // if(options.click && typeof options.click === 'function'){
- // options.click(e);
- // }
window.close_notification(e.target);
}else{
window.close_notification($(e.target).closest('.notification'));
@@ -74,15 +79,22 @@ $(document).on('click', '.notification', function(e){
$(document).on('click', '.notification-close', function(e){
window.close_notification($(e.target).closest('.notification'));
+ e.stopPropagation();
+ e.preventDefault();
+ return false;
});
window.close_notification = function(el_notification){
+ $(el_notification).closest('.notification-wrapper').animate({
+ height: 0,
+ opacity: 0
+ }, 200);
$(el_notification).addClass('animate__fadeOutRight');
-
// remove notification
setTimeout(function(){
+ $(el_notification).closest('.notification-wrapper').remove();
$(el_notification).remove();
}, 300);
}
diff --git a/src/css/style.css b/src/css/style.css
index c77eaf8b..b1209749 100644
--- a/src/css/style.css
+++ b/src/css/style.css
@@ -2432,8 +2432,10 @@ label {
/*****************************************************
* Notification
*****************************************************/
-.notification {
+.notification, .notification-wrapper{
width: 320px;
+}
+.notification {
min-height: 54px;
background: #ffffffcd;
backdrop-filter: blur(5px);
diff --git a/src/icons/bell.svg b/src/icons/bell.svg
new file mode 100644
index 00000000..1d000d34
--- /dev/null
+++ b/src/icons/bell.svg
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file