-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
107 lines (102 loc) · 3.51 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notice.js</title>
<meta name="description" content="A clean and simple message plugin, with no dependencies.">
<script src="notice.js"></script>
<link rel="stylesheet" href="notice.css">
<style>
html, body {
margin: 0;
padding: 0;
}
.container {
max-width: 700px;
padding: 60px 10px;
margin: 0 auto;
font-family: "Georgia", serif;
}
.container p, .container a {color: #666;}
.buttons {margin: 100px 0 80px;}
button {
padding: 10px 20px;
text-align: center;
border: none;
border-radius: 20px;
cursor: pointer;
font-size: 14px;
margin-right: 10px;
margin-bottom: 20px;
outline: none;
background: #fff;
border:1px solid #efefef;
color: #565656;
}
.buttons button:hover {opacity: 0.8;}
.success{background:#5cb85c;border-color:#5cb85c;color:#fff;}
.warning{background:#f0ad4e;border-color:#f0ad4e;color:#fff;}
.error{background:#d9534f;border-color:#d9534f;color:#fff;}
.info{background:#5bc0de;border-color:#5bc0de;color:#fff;}
</style>
</head>
<body>
<div class="container">
<h1>Notice.js</h1>
<p>A clean and simple message plugin, with no dependencies.</p>
<div class="buttons">
<button id="success" class="success">Success Message</button>
<button id="warning" class="warning">Warning Message</button>
<button id="error" class="error">Error Message</button>
<button id="info" class="info">Info Message</button>
<button id="hide">Show & Hide</button>
<button id="link">Link Message</button>
<button id="callback">Callback Message</button>
</div>
<p>
<a href="https://github.com/xiangming/notice.js">Docs on GitHub</a>
</p>
<p>
A native javascript plugin by
<a href="http://arvinxiang.com/" target="_blank">Arvin Xiang</a>
</p>
</div>
<script>
function $(id) { return document.getElementById(id) };
// notice.success for a success message
$('success').onclick = function() {
notice.success('A success message');
};
// notice.warning for a warning message
$('warning').onclick = function() {
notice.warning('A warning message');
};
// notice.error for a error message
$('error').onclick = function() {
notice.error('A error message');
};
// notice.info for a info message
$('info').onclick = function() {
notice.info('A info message');
};
// set time to hide it
$('hide').onclick = function() {
notice.success('This message will hide in 2 seconds', 2000);
};
// add link to a message
$('link').onclick = function() {
notice.success({
message: 'Click on this message',
url: 'http://arvinxiang.com/'
});
};
// callback when closed
$('callback').onclick = function() {
notice.success('A callback message', function(){
alert('callback function');
});
};
</script>
</body>
</html>