-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
140 lines (120 loc) · 3.23 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
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
<!-- This is an example file to show how to use the notificationManager -->
<!-- Latest jQuery -->
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<!-- Link the notificationManager stylesheet -->
<link rel="stylesheet" href="./notificationManager.css" />
<!-- Include the notificationManager script -->
<script src="./notificationManager.js"></script>
<style>
body
{
font-family: sans-serif;
margin:0;
padding:0;
}
.center
{
height: 100%;
width: 100%;
position: relative;
background-color:#F0F5FF;
}
.center > div
{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background-color: #B5D3ED;
padding: 20px;
border-radius: 10px;
-webkit-box-shadow: 0px 0px 53px -7px rgba(101,129,229,0.4);
-moz-box-shadow: 0px 0px 53px -7px rgba(101,129,229,0.4);
box-shadow: 0px 0px 53px -7px rgba(101,129,229,0.4);
}
.center p
{
margin:7px;
}
input[type="text"], select
{
display: block;
width: 200px;
height:35px;
border: 1px dotted #CAD3E5;
border-radius:5px;
padding: 5px;
margin-bottom:10px;
}
button
{
display:block;
width: 200px;
height:35px;
background-color: #98BFE0;
color:white;
border-radius:5px;
border:none;
margin-top:16px;
}
button:hover
{
background-color: #638EE9;
color:white;
}
h3
{
text-align:center;
}
</style>
<!-- Message Container -->
<div id="notificationsContainer">
</div>
<!-- Example DOM -->
<div class="center">
<div>
<h3>notificationManager</h3>
<p>Position:</p>
<p>
<select type="text" id="msg-pos">
<option value="topleft">Top-Left Corner</option>
<option value="topright">Top-Right Corner</option>
<option value="bottomleft">Bottom-Left Corner</option>
<option value="bottomright" selected>Bottom-Right Corner</option>
</select>
</p>
<p>Notification text:</p>
<p><input type="text" id="msg-text" value="Hello World!" /></p>
<p><input type="checkbox" id="animate" value="1" checked> Animate </p>
<p><input type="checkbox" id="autoRemove" value="1" checked> Auto-Remove</p>
<p><button id="notify">Notify</button></p>
</div>
</div>
<script>
//Create a notification manager
var notify = new notificationManager({container: $('#notificationsContainer'), position: "bottomright" });
//When clicking the example button
$('#notify').on('click', function ()
{
//are we animating yes/no?
var anim = $('#animate').is(":checked") ? true : false;
//are we automatically removing the notification after 6 seconds?
var auto = $('#autoRemove').is(":checked") ? true : false;
//what's the message?
var txt = $('#msg-text').val();
//notify.setPosition('topleft');
//trigger the notification
notify.addNotification(
{
message:txt,
animate:anim,
autoRemove:auto
});
});
$( "#msg-pos" ).change(function()
{
notify.setPosition( $('#msg-pos').val().toString() );
});
</script>