-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (92 loc) · 2.56 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
108
109
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>flex-notifictaions</title>
<link rel="stylesheet" href="styles/normalize.css">
<style>
.mod-notifications {
padding: 10px;
height: -webkit-calc(100% - 10px * 2);
height: calc(100% - 10px * 2);
display: -webkit-flex;
-webkit-flex-direction: column;
-webkit-flex-wrap: wrap-reverse;
-webkit-justify-content: flex-start;
-webkit-align-content: flex-start;
pointer-events: none;
-webkit-pointer-events: none;
position: fixed;
top: 0;
right: 0;
z-index: 100000;
}
.mod-notifications-notif {
margin: 10px 0 0 10px;
border: solid rgba(0,0,0,.3) 1px;
border-radius: 5px;
padding: 10px 0;
-webkit-flex: 1 1 auto;
width: 300px;
min-height: 50px;
max-height: 50px;
overflow: auto;
position: relative;
background-image: -webkit-gradient(linear, center top, center bottom, from(#f4f6f7), to(#e1e3e5));
box-shadow: 0px 0px 15px rgba(10,10,10,.3), 1px 1px 1px #fff inset;
pointer-events: auto;
-webkit-pointer-events: auto;
}
.mod-notifications-notif p {
margin: 0;
padding: 0 80px 0 10px;
}
.mod-notifications-notif .mod-notifications-notif-title {
font-weight: bold;
}
.mod-notifications-notif .mod-notifications-notif-close {
border: solid #88898a 1px;
border-radius: 5px;
padding: 3px 7px;
display: block;
position: absolute;
top: 10px;
right: 10px;
background-image: -webkit-gradient(linear, center top, center bottom, from(#fbfbfc), to(#f1f3f4));
box-shadow: 0px 0px 5px rgba(255,255,255,.7), 0px 0px 1px #fff inset;
cursor: pointer;
}
</style>
</head>
<body>
<p><input type="button" id="add" value="Add Notification"></p>
<div class="mod-notifications">
</div>
</body>
<script>
(function() {
var i = 0;
var add = document.getElementById('add');
var notifications = document.getElementsByClassName('mod-notifications')[0];
add.addEventListener('click', function() {
var notif = document.createElement('div');
notif.setAttribute('class', 'mod-notifications-notif');
notif.innerHTML = [
'<span class="mod-notifications-notif-close">閉じる</span>',
'<p class="mod-notifications-notif-message">nofit: ' + i++ + '</p>'
].join('');
notifications.appendChild(notif);
}, false);
document.body.addEventListener('click', function(e) {
var target = e.target;
if ( target
&& target.className
&& /^mod-notifications-notif-close$/.test(target.className)
) {
target.parentNode.parentNode.removeChild(target.parentNode);
}
}, false);
}());
</script>
</body>
</html>