-
Notifications
You must be signed in to change notification settings - Fork 2
/
WindowLayer.js
46 lines (46 loc) · 1.19 KB
/
WindowLayer.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
46
/**
* Created by reco on 2018/8/24.
*/
MElegant.regist("WindowLayer");
WindowLayer = function(){
this.animate = true;
this.dom = null;
this.view = null;
this.index = -1;
};
WindowLayer.prototype = {
in:function(){
console.log(this.animate);
if(this.animate) {
this.dom.css({
'transform':'translate('+screen.availWidth+'px,0)',
'left': 0,
'top': 0,
'positon':'absolute'
});
RootController.mainContainer.append(this.dom);
this.dom.animate({
translateX: '0',
duration:200
},function(){
this.view.shown();
}.bind(this));
} else {
RootController.mainContainer.append(this.dom);
this.view.shown();
}
},
out:function(){
if(this.animate) {
this.dom.animate({
'translateX':screen.availWidth+'px'
},function(){
this.view.destroy();
this.dom.remove();
}.bind(this));
} else {
this.view.destroy();
this.dom.remove();
}
}
};