-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
45 lines (43 loc) · 888 Bytes
/
main.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
39
40
41
42
43
44
45
var error = agility({
model: { "msg": '' },
view: {
format: [
"div", [
["span", {"data-bind": "msg"}],
["span", {"id": "close"}, "(Click anywhere to close)"]
]
],
style: {
"&": {
"position": "fixed",
"top": 0,
"left": 0,
"right": 0,
"z-index": 1000,
"background": "#f55",
"color": "white",
"display": "none",
"padding": "5px 15px"
},
"& #close": {
"float": "right"
}
}
},
controller: {},
// User-defined
show: function(s){
var self = this;
this.model.set({ "msg": s });
this.view.$().slideDown(200, function() {
$(document).one('click', function() {
self.hide();
});
});
},
hide: function() {
this.view.$().slideUp(100);
}
});
agility.document.append(error);
error.show("Hello");