-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotf.js
38 lines (36 loc) · 1.07 KB
/
notf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const container = document.getElementById('notfcontainer');
let notfContent
let closeButton = "";
function createNotf(params) {
if(params.autoClose == true) {
setTimeout(() => {
closeNotf();
}, params.autoCloseTime);
}
if (params.closable == true) {
closeButton = `
<button onclick="closeNotf()" id="closenotf">
<span class="material-icons">
close
</span>
</button>
`
}
notfContent = `
<div id="notf">
<img id="notficon" src="${params.icon}" alt="">
<p id="notficontext">${params.iconText}</p>
<p id="notftitle">${params.title}</p>
<img id="notfimage" src="${params.image}" alt="">
<p id="notfbody">${params.body}</p>
${closeButton}
</div>`
document.getElementById('notfcontainer').innerHTML = notfContent;
}
function closeNotf() {
const notf = document.getElementById('notf');
notf.style.animation = 'gotoright 1s cubic-bezier(1,0,.3,1)';
setTimeout(() => {
container.removeChild(notf);
}, 900);
}