filter-box 选中项目 改变颜色 code review by @bikai
Showing
3 changed files
with
41 additions
and
23 deletions
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | 26 | ||
27 | <div class="attr-content clearfix"> | 27 | <div class="attr-content clearfix"> |
28 | {{#each channel}} | 28 | {{#each channel}} |
29 | - <a class="attr" href="{{href}}"> | 29 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> |
30 | {{name}} | 30 | {{name}} |
31 | </a> | 31 | </a> |
32 | {{/each}} | 32 | {{/each}} |
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | <ul class="sort-pre clearfix"> | 42 | <ul class="sort-pre clearfix"> |
43 | {{#each sort}} | 43 | {{#each sort}} |
44 | <li> | 44 | <li> |
45 | - <span class="attr"> | 45 | + <span class="attr {{#if checked}}checked{{/if}}"> |
46 | {{name}} | 46 | {{name}} |
47 | </span> | 47 | </span> |
48 | </li> | 48 | </li> |
@@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
53 | {{#each sort}} | 53 | {{#each sort}} |
54 | <ul class="sort-sub clearfix hide"> | 54 | <ul class="sort-sub clearfix hide"> |
55 | {{#each sub}} | 55 | {{#each sub}} |
56 | - <li class="attr"> | 56 | + <li class="attr {{#if checked}}checked{{/if}}"> |
57 | <a href="{{href}}">{{name}}</a> | 57 | <a href="{{href}}">{{name}}</a> |
58 | </li> | 58 | </li> |
59 | {{/each}} | 59 | {{/each}} |
@@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
71 | <div class="attr-content"> | 71 | <div class="attr-content"> |
72 | <ul class="default clearfix"> | 72 | <ul class="default clearfix"> |
73 | {{# default}} | 73 | {{# default}} |
74 | - <li class="attr"> | 74 | + <li class="attr {{#if checked}}checked{{/if}}"> |
75 | <a href="{{href}}" title="{{name}}">{{name}}</a> | 75 | <a href="{{href}}" title="{{name}}">{{name}}</a> |
76 | </li> | 76 | </li> |
77 | {{/ default}} | 77 | {{/ default}} |
@@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
82 | <em>更多</em> | 82 | <em>更多</em> |
83 | <i class="iconfont"></i> | 83 | <i class="iconfont"></i> |
84 | </span> | 84 | </span> |
85 | - | 85 | + |
86 | <span id="brand-multi" class="multi-select">多选 +</span> | 86 | <span id="brand-multi" class="multi-select">多选 +</span> |
87 | </div> | 87 | </div> |
88 | 88 | ||
@@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
128 | 128 | ||
129 | <div class="attr-content clearfix"> | 129 | <div class="attr-content clearfix"> |
130 | {{# price}} | 130 | {{# price}} |
131 | - <a class="attr" href="{{href}}">¥{{name}}</a> | 131 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">¥{{name}}</a> |
132 | {{/ price}} | 132 | {{/ price}} |
133 | 133 | ||
134 | <div class="ud-price-range"> | 134 | <div class="ud-price-range"> |
@@ -146,10 +146,10 @@ | @@ -146,10 +146,10 @@ | ||
146 | {{#if color}} | 146 | {{#if color}} |
147 | <div class="color section"> | 147 | <div class="color section"> |
148 | <span class="title">颜色:</span> | 148 | <span class="title">颜色:</span> |
149 | - | 149 | + |
150 | <div class="attr-content clearfix"> | 150 | <div class="attr-content clearfix"> |
151 | {{# color}} | 151 | {{# color}} |
152 | - <a class="attr" href="{{href}}"> | 152 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> |
153 | <i class="color-block" style="background: {{rgb}}"></i> | 153 | <i class="color-block" style="background: {{rgb}}"></i> |
154 | {{name}} | 154 | {{name}} |
155 | </a> | 155 | </a> |
@@ -164,7 +164,7 @@ | @@ -164,7 +164,7 @@ | ||
164 | 164 | ||
165 | <div class="attr-content clearfix"> | 165 | <div class="attr-content clearfix"> |
166 | {{# size}} | 166 | {{# size}} |
167 | - <a class="attr" href="{{href}}">{{name}}</a> | 167 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a> |
168 | {{/ size}} | 168 | {{/ size}} |
169 | </div> | 169 | </div> |
170 | </div> | 170 | </div> |
@@ -194,7 +194,7 @@ | @@ -194,7 +194,7 @@ | ||
194 | {{/if}} | 194 | {{/if}} |
195 | <ul class="clearfix check-container"> | 195 | <ul class="clearfix check-container"> |
196 | {{#each sub}} | 196 | {{#each sub}} |
197 | - <li class="attr"> | 197 | + <li class="attr {{#if checked}}checked{{/if}}"> |
198 | <a href="{{href}}"> | 198 | <a href="{{href}}"> |
199 | <span class="iconfont checkbox" data-id="{{id}}"></span> | 199 | <span class="iconfont checkbox" data-id="{{id}}"></span> |
200 | <span>{{name}}</span> | 200 | <span>{{name}}</span> |
@@ -212,4 +212,4 @@ | @@ -212,4 +212,4 @@ | ||
212 | </div> | 212 | </div> |
213 | </div> | 213 | </div> |
214 | {{/if}} | 214 | {{/if}} |
215 | -</div> | ||
215 | +</div> |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | - .title { | 15 | + .title { |
16 | float: left; | 16 | float: left; |
17 | width: 90px; | 17 | width: 90px; |
18 | line-height: 30px; | 18 | line-height: 30px; |
@@ -44,6 +44,14 @@ | @@ -44,6 +44,14 @@ | ||
44 | margin-left: 0; | 44 | margin-left: 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | + &.checked { | ||
48 | + color: #e01; | ||
49 | + | ||
50 | + a { | ||
51 | + color: #e01; | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
47 | -moz-user-select: none; | 55 | -moz-user-select: none; |
48 | } | 56 | } |
49 | 57 | ||
@@ -287,4 +295,4 @@ | @@ -287,4 +295,4 @@ | ||
287 | .multi .checkbox { | 295 | .multi .checkbox { |
288 | display: inline; | 296 | display: inline; |
289 | } | 297 | } |
290 | -} | ||
298 | +} |
@@ -44,7 +44,8 @@ class Index1Controller extends AbstractAction | @@ -44,7 +44,8 @@ class Index1Controller extends AbstractAction | ||
44 | 'channel' => array( | 44 | 'channel' => array( |
45 | array( | 45 | array( |
46 | 'href' => '/?gender=1,3', | 46 | 'href' => '/?gender=1,3', |
47 | - 'name' => 'BOYS' | 47 | + 'name' => 'BOYS', |
48 | + 'checked' => true | ||
48 | ), | 49 | ), |
49 | array( | 50 | array( |
50 | 'href' => '/?gender=2,3', | 51 | 'href' => '/?gender=2,3', |
@@ -63,10 +64,12 @@ class Index1Controller extends AbstractAction | @@ -63,10 +64,12 @@ class Index1Controller extends AbstractAction | ||
63 | array( | 64 | array( |
64 | 'id' => '1', | 65 | 'id' => '1', |
65 | 'name' => '上衣', | 66 | 'name' => '上衣', |
67 | + 'checked' => true, | ||
66 | 'sub' => array( | 68 | 'sub' => array( |
67 | array( | 69 | array( |
68 | 'href' => '', | 70 | 'href' => '', |
69 | - 'name' => 'T恤' | 71 | + 'name' => 'T恤', |
72 | + 'checked' => true | ||
70 | ), | 73 | ), |
71 | array( | 74 | array( |
72 | 'href' => '', | 75 | 'href' => '', |
@@ -95,7 +98,8 @@ class Index1Controller extends AbstractAction | @@ -95,7 +98,8 @@ class Index1Controller extends AbstractAction | ||
95 | 'default' => array( | 98 | 'default' => array( |
96 | array( | 99 | array( |
97 | 'href' => '', | 100 | 'href' => '', |
98 | - 'name' => 'CLOT' | 101 | + 'name' => 'CLOT', |
102 | + 'checked' => true | ||
99 | ), | 103 | ), |
100 | array( | 104 | array( |
101 | 'href' => '', | 105 | 'href' => '', |
@@ -133,7 +137,8 @@ class Index1Controller extends AbstractAction | @@ -133,7 +137,8 @@ class Index1Controller extends AbstractAction | ||
133 | 'brandIndex' => array( | 137 | 'brandIndex' => array( |
134 | array( | 138 | array( |
135 | 'index' => 'all', | 139 | 'index' => 'all', |
136 | - 'name' => '全部' | 140 | + 'name' => '全部', |
141 | + 'checked' => true | ||
137 | ), | 142 | ), |
138 | array( | 143 | array( |
139 | 'index' => '0-9', | 144 | 'index' => '0-9', |
@@ -185,7 +190,8 @@ class Index1Controller extends AbstractAction | @@ -185,7 +190,8 @@ class Index1Controller extends AbstractAction | ||
185 | 'price' => array( | 190 | 'price' => array( |
186 | array( | 191 | array( |
187 | 'href' => '', | 192 | 'href' => '', |
188 | - 'name' => '0-239' | 193 | + 'name' => '0-239', |
194 | + 'checked' => true | ||
189 | ), | 195 | ), |
190 | array( | 196 | array( |
191 | 'href' => '', | 197 | 'href' => '', |
@@ -196,7 +202,8 @@ class Index1Controller extends AbstractAction | @@ -196,7 +202,8 @@ class Index1Controller extends AbstractAction | ||
196 | array( | 202 | array( |
197 | 'href' => '', | 203 | 'href' => '', |
198 | 'name' => '黑色', | 204 | 'name' => '黑色', |
199 | - 'rgb' => '#000' | 205 | + 'rgb' => '#000', |
206 | + 'checked' => true | ||
200 | ), | 207 | ), |
201 | array( | 208 | array( |
202 | 'href' => '', | 209 | 'href' => '', |
@@ -207,7 +214,8 @@ class Index1Controller extends AbstractAction | @@ -207,7 +214,8 @@ class Index1Controller extends AbstractAction | ||
207 | 'size' => array( | 214 | 'size' => array( |
208 | array( | 215 | array( |
209 | 'href' => '', | 216 | 'href' => '', |
210 | - 'name' => 'S' | 217 | + 'name' => 'S', |
218 | + 'checked' => true | ||
211 | ), | 219 | ), |
212 | array( | 220 | array( |
213 | 'href' => '', | 221 | 'href' => '', |
@@ -223,7 +231,8 @@ class Index1Controller extends AbstractAction | @@ -223,7 +231,8 @@ class Index1Controller extends AbstractAction | ||
223 | array( | 231 | array( |
224 | 'id' => '1', | 232 | 'id' => '1', |
225 | 'href' => '', | 233 | 'href' => '', |
226 | - 'name' => '街头' | 234 | + 'name' => '街头', |
235 | + 'checked' => true | ||
227 | ), | 236 | ), |
228 | array( | 237 | array( |
229 | 'id' => '2', | 238 | 'id' => '2', |
@@ -239,7 +248,8 @@ class Index1Controller extends AbstractAction | @@ -239,7 +248,8 @@ class Index1Controller extends AbstractAction | ||
239 | array( | 248 | array( |
240 | 'id' => '1', | 249 | 'id' => '1', |
241 | 'href' => '', | 250 | 'href' => '', |
242 | - 'name' => '春天' | 251 | + 'name' => '春天', |
252 | + 'checked' => true | ||
243 | ), | 253 | ), |
244 | array( | 254 | array( |
245 | 'id' => '2', | 255 | 'id' => '2', |
@@ -1544,4 +1554,4 @@ class Index1Controller extends AbstractAction | @@ -1544,4 +1554,4 @@ class Index1Controller extends AbstractAction | ||
1544 | 1554 | ||
1545 | $this->echoJson($data); | 1555 | $this->echoJson($data); |
1546 | } | 1556 | } |
1547 | -} | ||
1557 | +} |
-
Please register or login to post a comment