回答編集履歴
1
ならびかえ
test
CHANGED
@@ -235,3 +235,257 @@
|
|
235
235
|
```
|
236
236
|
|
237
237
|
で、並び替えって何をすればいいのでしょうか?
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
# 並び替えつき
|
242
|
+
|
243
|
+
```javascript
|
244
|
+
|
245
|
+
<script>
|
246
|
+
|
247
|
+
$(function(){
|
248
|
+
|
249
|
+
$('.price-tex :checkbox').on('change',function(){
|
250
|
+
|
251
|
+
var feature=$('.price-tex :checkbox:checked').map(function(){return $(this).attr('id');}).get();
|
252
|
+
|
253
|
+
$('.col').each(function(){
|
254
|
+
|
255
|
+
var cls=$(this).prop('classList');
|
256
|
+
|
257
|
+
var flg=feature.some(function(x){
|
258
|
+
|
259
|
+
return [].indexOf.call(cls,x)>-1;
|
260
|
+
|
261
|
+
});
|
262
|
+
|
263
|
+
$(this).toggle(flg);
|
264
|
+
|
265
|
+
});
|
266
|
+
|
267
|
+
}).eq(0).trigger('change');
|
268
|
+
|
269
|
+
$('.sort').on('click',function(){
|
270
|
+
|
271
|
+
var id=$(this).attr('id');
|
272
|
+
|
273
|
+
var narabi=$('.narabi').get();
|
274
|
+
|
275
|
+
narabi.sort(function(x,y){
|
276
|
+
|
277
|
+
return parseInt($(x).find('.'+id).attr('name'))>parseInt($(y).find('.'+id).attr('name'));
|
278
|
+
|
279
|
+
});
|
280
|
+
|
281
|
+
$('.price-w-img').append(narabi);
|
282
|
+
|
283
|
+
});
|
284
|
+
|
285
|
+
});
|
286
|
+
|
287
|
+
</script>
|
288
|
+
|
289
|
+
<h3>特性から絞り込み
|
290
|
+
|
291
|
+
</h3>
|
292
|
+
|
293
|
+
<div class="price-tex">
|
294
|
+
|
295
|
+
<input type="checkbox" id="Feature1" data-group="0"><label for="Feature1">F1</label>
|
296
|
+
|
297
|
+
<input type="checkbox" id="Feature2" data-group="0"><label for="Feature2">F2</label>
|
298
|
+
|
299
|
+
<input type="checkbox" id="Feature3" data-group="0"><label for="Feature3">F3</label>
|
300
|
+
|
301
|
+
<input type="checkbox" id="Feature4" data-group="0"><label for="Feature4">F4</label>
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
<button id="price" class="sort">
|
308
|
+
|
309
|
+
price順
|
310
|
+
|
311
|
+
</button>
|
312
|
+
|
313
|
+
<button id="age" class="sort">
|
314
|
+
|
315
|
+
age数順
|
316
|
+
|
317
|
+
</button>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
<div class="price-w-img">
|
322
|
+
|
323
|
+
<div class="narabi">
|
324
|
+
|
325
|
+
<div style="border: 1px solid;" class="col Feature1 Feature3 Feature4">
|
326
|
+
|
327
|
+
<div class="paint-title">タイトル</span></div>
|
328
|
+
|
329
|
+
<span>Feature1 Feature3 Feature4 age:15 price:799</span>
|
330
|
+
|
331
|
+
<div class="point-box">
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
<div class="chara">
|
336
|
+
|
337
|
+
<p>特性</p>
|
338
|
+
|
339
|
+
<ul>
|
340
|
+
|
341
|
+
<li>リスト</li>
|
342
|
+
|
343
|
+
<li>リスト</li>
|
344
|
+
|
345
|
+
<li>リスト</li>
|
346
|
+
|
347
|
+
<li>リスト</li>
|
348
|
+
|
349
|
+
</ul>
|
350
|
+
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
<div>
|
356
|
+
|
357
|
+
<p class="descrip">ディスクリプション</p>
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<table border class="space">
|
362
|
+
|
363
|
+
<thead>
|
364
|
+
|
365
|
+
<tr>
|
366
|
+
|
367
|
+
<th>age数</th>
|
368
|
+
|
369
|
+
<th>1</th>
|
370
|
+
|
371
|
+
<th>2</th>
|
372
|
+
|
373
|
+
<th>3</th>
|
374
|
+
|
375
|
+
<th>4</th>
|
376
|
+
|
377
|
+
</tr>
|
378
|
+
|
379
|
+
</thead>
|
380
|
+
|
381
|
+
<tbody>
|
382
|
+
|
383
|
+
<tr>
|
384
|
+
|
385
|
+
<td><span class="age" name="15">15</span>~20</td>
|
386
|
+
|
387
|
+
<td><span class="price" name="799">799</span>,</td>
|
388
|
+
|
389
|
+
<td>829,</td>
|
390
|
+
|
391
|
+
<td>899,</td>
|
392
|
+
|
393
|
+
<td>1,098,</td>
|
394
|
+
|
395
|
+
</tr>
|
396
|
+
|
397
|
+
</tbody>
|
398
|
+
|
399
|
+
</table>
|
400
|
+
|
401
|
+
</div>
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
<div class="narabi">
|
406
|
+
|
407
|
+
<div style="border: 1px solid;" class="col Feature1 Feature4 Feature5">
|
408
|
+
|
409
|
+
<div class="paint-title">タイトル</span></div>
|
410
|
+
|
411
|
+
<div class="point-box">
|
412
|
+
|
413
|
+
<span>Feature1 Feature4 Feature5 age:20 price:674</span>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<div class="chara">
|
418
|
+
|
419
|
+
<p>特性</p>
|
420
|
+
|
421
|
+
<ul>
|
422
|
+
|
423
|
+
<li>リスト</li>
|
424
|
+
|
425
|
+
<li>リスト</li>
|
426
|
+
|
427
|
+
<li>リスト</li>
|
428
|
+
|
429
|
+
<li>リスト</li>
|
430
|
+
|
431
|
+
</ul>
|
432
|
+
|
433
|
+
</div>
|
434
|
+
|
435
|
+
</div>
|
436
|
+
|
437
|
+
<div>
|
438
|
+
|
439
|
+
<p class="descrip">ディスクリプション</p>
|
440
|
+
|
441
|
+
</div>
|
442
|
+
|
443
|
+
<table border class="space">
|
444
|
+
|
445
|
+
<thead>
|
446
|
+
|
447
|
+
<tr>
|
448
|
+
|
449
|
+
<th>age数</th>
|
450
|
+
|
451
|
+
<th>1</th>
|
452
|
+
|
453
|
+
<th>2</th>
|
454
|
+
|
455
|
+
<th>3</th>
|
456
|
+
|
457
|
+
<th>4</th>
|
458
|
+
|
459
|
+
</tr>
|
460
|
+
|
461
|
+
</thead>
|
462
|
+
|
463
|
+
<tbody>
|
464
|
+
|
465
|
+
<tr>
|
466
|
+
|
467
|
+
<td><span class="age" name="20">20</span>以上</td>
|
468
|
+
|
469
|
+
<td><span class="price" name="674">674,</span></td>
|
470
|
+
|
471
|
+
<td>708,</td>
|
472
|
+
|
473
|
+
<td>787,</td>
|
474
|
+
|
475
|
+
<td>956,</td>
|
476
|
+
|
477
|
+
</tr>
|
478
|
+
|
479
|
+
</tbody>
|
480
|
+
|
481
|
+
</table>
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
</div>
|
486
|
+
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</div>
|
490
|
+
|
491
|
+
```
|