/
app.js
150 lines (141 loc) · 3.73 KB
/
app.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
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
141
142
143
144
145
146
147
148
149
150
// Generated by CoffeeScript 1.6.3
(function() {
var firstNavItem, hideSub, itemContainer, items, showSub, subItemContainer, subItems;
items = ["All Deals", "New Deals", "Food & Drink", "Events & Activities", "Beauty & Spas", "Health & Fitness", "Home & Garden", "Automotive", "Shopping"];
firstNavItem = null;
itemContainer = new View({
width: 640,
clip: false
});
items.map(function(item, index) {
var itemView;
itemView = new View({
superView: itemContainer,
width: 640,
height: 88,
x: 0,
y: 1000 + index * 88,
opacity: 0,
clip: false,
"class": 'framer list'
});
if (index === 0) {
firstNavItem = itemView;
}
itemView.style = {
borderBottom: "1px solid rgba(0,0,0,.2)",
lineHeight: "" + itemView.height + "px",
paddingLeft: "20px",
cursor: "pointer",
backgroundColor: "#f0f0f0"
};
if (index > 1) {
itemView.html = "" + item + " <span></span>";
} else {
itemView.html = "" + item;
}
utils.delay(index * 30, function() {
return itemView.animate({
properties: {
y: 216 + index * 88,
opacity: 1
},
curve: "spring(500,30,800)"
});
});
return itemView.on(Events.TouchStart, function() {
var moveTop, originalPosition;
if (index > 0 && itemView.y !== 216) {
originalPosition = itemView.y;
moveTop = new Animation({
view: itemView,
properties: {
y: 216
},
curve: "ease-out",
time: 300
});
itemView.html = "" + item + " <span class='close'></span>";
moveTop.start();
utils.delay(100, showSub);
return itemView.on(Events.TouchStart, function(event) {
var moveBack;
itemView.html = "" + item + " <span></span>";
moveBack = new Animation({
view: itemView,
properties: {
y: originalPosition
},
curve: "ease-out",
time: 300
});
moveBack.start();
return hideSub();
});
}
});
});
subItems = ["Sub Cat One (32)", "Sub Cat Two (14)", "Sub Cat Three (21)", "Sub Cat Four (11)", "Sub Cat Five (23)", "Sub Cat Six (5)", "Sub Cat Seven (14)", "Sub Cat Eight (24)"];
subItemContainer = new View({
properties: {
y: 1136
},
clip: false
});
hideSub = function() {
subItemContainer.animate({
properties: {
opacity: 0
},
curve: "ease-out",
time: 300
});
return subItemContainer.destroy();
};
showSub = function() {
subItemContainer = new View({
properties: {
y: 1136,
width: 640
},
clip: false,
style: {
backgroundColor: "#fafafa"
}
});
return subItems.map(function(item, index) {
var subItemView;
subItemView = new View({
superView: subItemContainer,
width: 640,
height: 88,
x: 640,
y: 304 + index * 88,
opacity: 0,
clip: true,
"class": 'framer list'
});
subItemView.style = {
borderBottom: "1px solid rgba(0,0,0,.2)",
lineHeight: "" + subItemView.height + "px",
color: "#75787b",
paddingLeft: "40px",
cursor: "pointer",
backgroundColor: "#fafafa"
};
subItemView.html = "" + item;
utils.delay(index * 30, function() {
return subItemView.animate({
properties: {
x: 0,
opacity: 1
},
curve: "spring(400,30,800)"
});
});
return subItemView.on(Events.TouchStart, function() {
return alert("Load Sub-Category");
});
});
};
}).call(this);