質問編集履歴
1
each(function)に入っていたsortを削除しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,6 +4,214 @@
|
|
4
4
|
|
5
5
|
} else {
|
6
6
|
|
7
|
+
$(".list").find("li").each(function() {
|
8
|
+
|
9
|
+
if($(this).data('category-type') === cateVal) {
|
10
|
+
|
11
|
+
$(this).show();
|
12
|
+
|
13
|
+
} else {
|
14
|
+
|
15
|
+
$(this).hide();
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
});
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
・HTML全体
|
30
|
+
|
31
|
+
<!doctype html>
|
32
|
+
|
33
|
+
<html>
|
34
|
+
|
35
|
+
<head>
|
36
|
+
|
37
|
+
<meta charset="UTF-8">
|
38
|
+
|
39
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
40
|
+
|
41
|
+
<meta name="format-detection" content="telephone=no">
|
42
|
+
|
43
|
+
<title>jQuery</title>
|
44
|
+
|
45
|
+
<link rel="stylesheet" href="../../common/css/reset.css">
|
46
|
+
|
47
|
+
<link rel="stylesheet" href="../../common/css/base.css">
|
48
|
+
|
49
|
+
<link rel="stylesheet" href="./css/style.css">
|
50
|
+
|
51
|
+
</head>
|
52
|
+
|
53
|
+
<body>
|
54
|
+
|
55
|
+
<div class="wrapper">
|
56
|
+
|
57
|
+
<div class="contents">
|
58
|
+
|
59
|
+
<p class="title">Frameworks</p>
|
60
|
+
|
61
|
+
<div class="select-wrapper">
|
62
|
+
|
63
|
+
<select class="select">
|
64
|
+
|
65
|
+
<option value="all">All</option>
|
66
|
+
|
67
|
+
<option value="css">CSS</option>
|
68
|
+
|
69
|
+
<option value="javascript">JavaScript</option>
|
70
|
+
|
71
|
+
<option value="php">PHP</option>
|
72
|
+
|
73
|
+
<option value="ruby">Ruby</option>
|
74
|
+
|
75
|
+
<option value="python">Python</option>
|
76
|
+
|
77
|
+
<option value="scala">Scala</option>
|
78
|
+
|
79
|
+
</select>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<ul class="list">
|
84
|
+
|
85
|
+
<li data-category-type="css">
|
86
|
+
|
87
|
+
<a href="http://getbootstrap.com/" class="article">
|
88
|
+
|
89
|
+
<i class="article-icon is-bootstrap"></i>
|
90
|
+
|
91
|
+
<p class="article-name">Bootstrap</p>
|
92
|
+
|
93
|
+
</a>
|
94
|
+
|
95
|
+
</li>
|
96
|
+
|
97
|
+
<li data-category-type="ruby">
|
98
|
+
|
99
|
+
<a href="http://rubyonrails.org/" class="article">
|
100
|
+
|
101
|
+
<i class="article-icon is-ruby-on-rails"></i>
|
102
|
+
|
103
|
+
<p class="article-name">Ruby on Rails</p>
|
104
|
+
|
105
|
+
</a>
|
106
|
+
|
107
|
+
</li>
|
108
|
+
|
109
|
+
<li data-category-type="php">
|
110
|
+
|
111
|
+
<a href="https://phalconphp.com/ja/" class="article">
|
112
|
+
|
113
|
+
<i class="article-icon is-phalcon"></i>
|
114
|
+
|
115
|
+
<p class="article-name">Phalcon</p>
|
116
|
+
|
117
|
+
</a>
|
118
|
+
|
119
|
+
</li>
|
120
|
+
|
121
|
+
<li data-category-type="javascript">
|
122
|
+
|
123
|
+
<a href="https://facebook.github.io/react/" class="article">
|
124
|
+
|
125
|
+
<i class="article-icon is-react"></i>
|
126
|
+
|
127
|
+
<p class="article-name">React</p>
|
128
|
+
|
129
|
+
</a>
|
130
|
+
|
131
|
+
</li>
|
132
|
+
|
133
|
+
<li data-category-type="scala">
|
134
|
+
|
135
|
+
<a href="https://www.playframework.com/" class="article">
|
136
|
+
|
137
|
+
<i class="article-icon is-play"></i>
|
138
|
+
|
139
|
+
<p class="article-name">Play</p>
|
140
|
+
|
141
|
+
</a>
|
142
|
+
|
143
|
+
</li>
|
144
|
+
|
145
|
+
<li data-category-type="javascript">
|
146
|
+
|
147
|
+
<a href="http://aurelia.io/" class="article">
|
148
|
+
|
149
|
+
<i class="article-icon is-aurelia"></i>
|
150
|
+
|
151
|
+
<p class="article-name">Aurelia</p>
|
152
|
+
|
153
|
+
</a>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
<li data-category-type="python">
|
158
|
+
|
159
|
+
<a href="http://djangoproject.jp/" class="article">
|
160
|
+
|
161
|
+
<i class="article-icon is-django"></i>
|
162
|
+
|
163
|
+
<p class="article-name">Django</p>
|
164
|
+
|
165
|
+
</a>
|
166
|
+
|
167
|
+
</li>
|
168
|
+
|
169
|
+
<li data-category-type="css">
|
170
|
+
|
171
|
+
<a href="http://www.material-ui.com/#/" class="article">
|
172
|
+
|
173
|
+
<i class="article-icon is-material-ui"></i>
|
174
|
+
|
175
|
+
<p class="article-name">Material UI</p>
|
176
|
+
|
177
|
+
</a>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
<li data-category-type="php">
|
182
|
+
|
183
|
+
<a href="https://laravel.com/" class="article">
|
184
|
+
|
185
|
+
<i class="article-icon is-laravel"></i>
|
186
|
+
|
187
|
+
<p class="article-name">Laravel</p>
|
188
|
+
|
189
|
+
</a>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
</ul>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<script src="../../common/js/jquery.js"></script>
|
200
|
+
|
201
|
+
<script>
|
202
|
+
|
203
|
+
$(function() {
|
204
|
+
|
205
|
+
$(".select").change(function() {
|
206
|
+
|
207
|
+
var cateVal = $(this).val();
|
208
|
+
|
209
|
+
if(cateVal === 'all') {
|
210
|
+
|
211
|
+
$(".list").find("li").show();
|
212
|
+
|
213
|
+
} else {
|
214
|
+
|
7
215
|
$(".list").find("li").each(function(sort) {
|
8
216
|
|
9
217
|
if($(this).data('category-type') === cateVal) {
|
@@ -20,214 +228,6 @@
|
|
20
228
|
|
21
229
|
}
|
22
230
|
|
23
|
-
```
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
```
|
28
|
-
|
29
|
-
・HTML全体
|
30
|
-
|
31
|
-
<!doctype html>
|
32
|
-
|
33
|
-
<html>
|
34
|
-
|
35
|
-
<head>
|
36
|
-
|
37
|
-
<meta charset="UTF-8">
|
38
|
-
|
39
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
40
|
-
|
41
|
-
<meta name="format-detection" content="telephone=no">
|
42
|
-
|
43
|
-
<title>jQuery</title>
|
44
|
-
|
45
|
-
<link rel="stylesheet" href="../../common/css/reset.css">
|
46
|
-
|
47
|
-
<link rel="stylesheet" href="../../common/css/base.css">
|
48
|
-
|
49
|
-
<link rel="stylesheet" href="./css/style.css">
|
50
|
-
|
51
|
-
</head>
|
52
|
-
|
53
|
-
<body>
|
54
|
-
|
55
|
-
<div class="wrapper">
|
56
|
-
|
57
|
-
<div class="contents">
|
58
|
-
|
59
|
-
<p class="title">Frameworks</p>
|
60
|
-
|
61
|
-
<div class="select-wrapper">
|
62
|
-
|
63
|
-
<select class="select">
|
64
|
-
|
65
|
-
<option value="all">All</option>
|
66
|
-
|
67
|
-
<option value="css">CSS</option>
|
68
|
-
|
69
|
-
<option value="javascript">JavaScript</option>
|
70
|
-
|
71
|
-
<option value="php">PHP</option>
|
72
|
-
|
73
|
-
<option value="ruby">Ruby</option>
|
74
|
-
|
75
|
-
<option value="python">Python</option>
|
76
|
-
|
77
|
-
<option value="scala">Scala</option>
|
78
|
-
|
79
|
-
</select>
|
80
|
-
|
81
|
-
</div>
|
82
|
-
|
83
|
-
<ul class="list">
|
84
|
-
|
85
|
-
<li data-category-type="css">
|
86
|
-
|
87
|
-
<a href="http://getbootstrap.com/" class="article">
|
88
|
-
|
89
|
-
<i class="article-icon is-bootstrap"></i>
|
90
|
-
|
91
|
-
<p class="article-name">Bootstrap</p>
|
92
|
-
|
93
|
-
</a>
|
94
|
-
|
95
|
-
</li>
|
96
|
-
|
97
|
-
<li data-category-type="ruby">
|
98
|
-
|
99
|
-
<a href="http://rubyonrails.org/" class="article">
|
100
|
-
|
101
|
-
<i class="article-icon is-ruby-on-rails"></i>
|
102
|
-
|
103
|
-
<p class="article-name">Ruby on Rails</p>
|
104
|
-
|
105
|
-
</a>
|
106
|
-
|
107
|
-
</li>
|
108
|
-
|
109
|
-
<li data-category-type="php">
|
110
|
-
|
111
|
-
<a href="https://phalconphp.com/ja/" class="article">
|
112
|
-
|
113
|
-
<i class="article-icon is-phalcon"></i>
|
114
|
-
|
115
|
-
<p class="article-name">Phalcon</p>
|
116
|
-
|
117
|
-
</a>
|
118
|
-
|
119
|
-
</li>
|
120
|
-
|
121
|
-
<li data-category-type="javascript">
|
122
|
-
|
123
|
-
<a href="https://facebook.github.io/react/" class="article">
|
124
|
-
|
125
|
-
<i class="article-icon is-react"></i>
|
126
|
-
|
127
|
-
<p class="article-name">React</p>
|
128
|
-
|
129
|
-
</a>
|
130
|
-
|
131
|
-
</li>
|
132
|
-
|
133
|
-
<li data-category-type="scala">
|
134
|
-
|
135
|
-
<a href="https://www.playframework.com/" class="article">
|
136
|
-
|
137
|
-
<i class="article-icon is-play"></i>
|
138
|
-
|
139
|
-
<p class="article-name">Play</p>
|
140
|
-
|
141
|
-
</a>
|
142
|
-
|
143
|
-
</li>
|
144
|
-
|
145
|
-
<li data-category-type="javascript">
|
146
|
-
|
147
|
-
<a href="http://aurelia.io/" class="article">
|
148
|
-
|
149
|
-
<i class="article-icon is-aurelia"></i>
|
150
|
-
|
151
|
-
<p class="article-name">Aurelia</p>
|
152
|
-
|
153
|
-
</a>
|
154
|
-
|
155
|
-
</li>
|
156
|
-
|
157
|
-
<li data-category-type="python">
|
158
|
-
|
159
|
-
<a href="http://djangoproject.jp/" class="article">
|
160
|
-
|
161
|
-
<i class="article-icon is-django"></i>
|
162
|
-
|
163
|
-
<p class="article-name">Django</p>
|
164
|
-
|
165
|
-
</a>
|
166
|
-
|
167
|
-
</li>
|
168
|
-
|
169
|
-
<li data-category-type="css">
|
170
|
-
|
171
|
-
<a href="http://www.material-ui.com/#/" class="article">
|
172
|
-
|
173
|
-
<i class="article-icon is-material-ui"></i>
|
174
|
-
|
175
|
-
<p class="article-name">Material UI</p>
|
176
|
-
|
177
|
-
</a>
|
178
|
-
|
179
|
-
</li>
|
180
|
-
|
181
|
-
<li data-category-type="php">
|
182
|
-
|
183
|
-
<a href="https://laravel.com/" class="article">
|
184
|
-
|
185
|
-
<i class="article-icon is-laravel"></i>
|
186
|
-
|
187
|
-
<p class="article-name">Laravel</p>
|
188
|
-
|
189
|
-
</a>
|
190
|
-
|
191
|
-
</li>
|
192
|
-
|
193
|
-
</ul>
|
194
|
-
|
195
|
-
</div>
|
196
|
-
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<script src="../../common/js/jquery.js"></script>
|
200
|
-
|
201
|
-
<script>
|
202
|
-
|
203
|
-
$(function() {
|
204
|
-
|
205
|
-
$(".select").change(function() {
|
206
|
-
|
207
|
-
var cateVal = $(this).val();
|
208
|
-
|
209
|
-
if(cateVal === 'all') {
|
210
|
-
|
211
|
-
$(".list").find("li").show();
|
212
|
-
|
213
|
-
} else {
|
214
|
-
|
215
|
-
$(".list").find("li").each(function(sort) {
|
216
|
-
|
217
|
-
if($(this).data('category-type') === cateVal) {
|
218
|
-
|
219
|
-
$(this).show();
|
220
|
-
|
221
|
-
} else {
|
222
|
-
|
223
|
-
$(this).hide();
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
|
-
});
|
228
|
-
|
229
|
-
}
|
230
|
-
|
231
231
|
});
|
232
232
|
|
233
233
|
});
|