-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.html
332 lines (332 loc) · 7.37 KB
/
example.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<html>
<head>
<meta charset="utf-8">
<title>notiFire.js</title>
<style>
body {
margin: 0;
}
body h1 {
color: #555;
text-align: center;
}
.version {
font-size: 0.35em;
}
.top-info {
text-align: center;
color: #999;
font-size: 1em
}
.demo-header {
text-align: center;
background-color: #6D9197;
height: 1.7em;
color: white;
margin-bottom: 1em;
font-size: 1.4em;
}
.demo-div {
width: 600px;
height: auto;
text-align: left;
margin: 5px auto 5px auto;
padding-left: 10px;
background-color: #eee;
border: 1px solid #eee;
border-left: 5px solid #6D9197;
border-right: 1px solid #eee;
white-space: pre-wrap;
cursor: pointer;
}
.demo-div:hover {
border-style: solid;
border-width: 1px;
border-color: #6D9197;
border-left: 5px solid #6D9197;
border-right: 1px solid #6D9197;
}
.demo-doc {
width: 600px;
height: auto;
text-align: left;
margin: 5px auto 5px auto;
padding-left: 10px;
background-color: #eee;
border-left: 5px solid #6D9197;
}
.demo-doc p {
margin: 5px;
}
.bottom-info {
text-align: center;
color: #999;
font-size: 1em
}
</style>
<link href="css/notiFire.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1>
notiFire
<span class="version">0.9</span>
</h1>
<div class="top-info">--- A simple message notification library</div>
<div class="demo-header">
<h2>Demos</h2>
</div>
<div>
<div class="demo-div" onclick="notifire1()">
<b>Basic Example:</b>
<code>
notifire({
msg: 'this is a test message'
});
</code>
</div>
<div class="demo-div" onclick="notifire2()">
<b>Choose the type</b>
<code>
notifire({
msg: 'Yeah!!! Success!!!',
types: 'success'
});
</code>
</div>
<div class="demo-div" onclick="notifire3()">
<b>Any size you wany</b>
<code>
notifire({
msg: 'this is a test message with width of 400px and height of 200px',
types: 'info',
width: 400,
height: 200
});
</code>
</div>
<div class="demo-div" onclick="notifire4()">
<b>Left or right?</b>
<code>
notifire({
msg: 'I am on the right',
types: 'warning',
position: 'right'
});
</code>
</div>
<div class="demo-div" onclick="notifire5()">
<b>When should I disappear?</b>
<code>
notifire({
msg: 'I will be gone in 1 second!!!',
types: 'danger',
timeout: 1000
});
</code>
</div>
<div class="demo-div" onclick="notifire10()">
<b>I will not disappear</b>
<code>
notifire({
msg: 'I will not disappear',
types: 'danger',
timeout: false
});
</code>
</div>
<div class="demo-div" onclick="notifire6()">
<b>Whatever color you need.</b>
<code>
notifire({
msg: 'I am different than the others :)',
types: 'danger',
backgroundColor: 'red'
});
</code>
</div>
<div class="demo-div" onclick="notifire7()">
<b>Customize your border:</b>
<code>
notifire({
msg: 'Look! I have a border!',
types: 'danger',
backgroundColor: 'red'
});
</code>
</div>
<div class="demo-div" onclick="notifire8()">
<b>Customize your content color:</b>
<code>
notifire({
msg: 'Font color is up to you.',
types: 'danger',
backgroundColor: 'red'
});
</code>
</div>
<div class="demo-div" onclick="notifire9()">
<b>Opacity is cool!</b>
<code>
notifire({
msg: 'Opacity is cool!',
types: 'info',
opacity: 0.3
});
</code>
</div>
<div class="demo-div" onclick="notifire11()">
<b>Callback</b>
<code>
notifire({
msg: 'See how callback is fired',
types: 'info',
callabck: function() { alert('callback is fired!'); }
});
</code>
</div>
</div>
<div class="demo-header">
<h2>Usage</h2>
</div>
<div class="demo-doc">
<b>Parameters:</b>
<p><b>• msg</b> - (string, required): the content of your message</p>
<p><b>• types</b> - (string): choose from 'success', 'info', 'warning', 'danger' or 'default'. Each type have a different background color.</p>
<p><b>• width</b> - (integer): width of the notificatoin message in px</p>
<p><b>• height</b> - (integer): height of the notificatoin message in px</p>
<p><b>• color</b> - (string): color of the text message, could be CSS default colors or hex colors</p>
<p><b>• borderStyle</b> - (string): the border-style of the message div, should be valid border-style value</p>
<p><b>• borderWidth</b> - (integer): border-width of the message div in px</p>
<p><b>• borderColor</b> - (string): the border-color of the message div, could be CSS default colors or hex colors</p>
<p><b>• backgroundColor</b> - (string): the backgroudn-color of the message div, could be CSS default colors or hex colors</p>
<p><b>• opacity</b> - (float): the opacity value of the message div</p>
<p><b>• position</b> - (string): 'left' or 'right'</p>
<p><b>• timeout</b> - (integer): how long do you need to display the message, in ms. 'false' if don't need auto-disappear</p>
<p><b>• callback</b> - (function): the callback function to trigger when clicking the message to close it.</p>
</div>
<div class="demo-div" onclick="notifire12()">
<b>Full Example</b>
<code>
notifire({
msg: 'See how callback is fired',
types: 'info',
width: 300,
height: 200,
color: 'white',
borderStyle: 'solid',
borderWidth: 1,
borderColor: '#33aaee',
backgroundColor: 'blue',
opacity: 0.5,
position: 'right',
timeout: 'false',
callback: function() { alert('callback after full-example has been triggered.'); }
});
</code>
</div>
<div class="bottom-info">Developed by <a target="_blank"href="https://github.com/DongZhang">Dong</a> | Get it on <a target="_blank" href="https://github.com/DongZhang/notiFire">GitHub</a></div>
</body>
<script>
function notifire1() {
notifire({
msg: 'this is a test message'
});
}
function notifire2() {
notifire({
msg: 'Yeah!!! Success!!!',
types: 'success'
});
}
function notifire3() {
notifire({
msg: 'this is a test message with width of 400px and height of 200px',
types: 'info',
width: 400,
height: 200
});
}
function notifire4() {
notifire({
msg: 'I am on the right',
types: 'warning',
position: 'right'
});
}
function notifire5() {
notifire({
msg: 'I will be gone in 1 second!!!',
types: 'danger',
timeout: 1000
});
}
function notifire6() {
notifire({
msg: 'I am different than the others :)',
types: 'danger',
width: 300,
backgroundColor: 'red',
timeout: 5000
});
}
function notifire7() {
notifire({
msg: 'Look! I have a border!',
types: 'success',
width: 300,
height: 100,
borderStyle: 'solid',
borderWidth: 5,
borderColor: '#33aaee'
});
}
function notifire8() {
notifire({
msg: 'Font color is up to you.',
types: 'danger',
color: 'white',
timeout: 5000
});
}
function notifire9() {
notifire({
msg: 'Opacity is cool',
types: 'info',
opacity: 0.3,
timeout: 5000
})
}
function notifire10() {
notifire({
msg: 'I will not disappear unless you click me.',
types: 'danger',
timeout: 'false'
});
}
function notifire11() {
notifire({
msg: 'See how callback is fired',
types: 'info',
callback: function() { alert('callback is fired!'); }
});
}
function notifire12() {
notifire({
msg: 'See how callback is fired',
types: 'info',
width: 300,
height: 200,
color: 'white',
borderStyle: 'solid',
borderWidth: 1,
borderColor: '#33aaee',
backgroundColor: 'blue',
opacity: 0.5,
position: 'right',
timeout: 'false',
callback: function() { alert('callback after full-example has been triggered.'); }
});
}
</script>
<script src="js/notiFire.js" type="text/javascript"></script>
</html>