質問編集履歴
1
質問内容を変更しました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jsでブレイクポイントの分岐+リロードの実装記述
|
test
CHANGED
@@ -1,18 +1,30 @@
|
|
1
|
-
解決させたいことは、
|
1
|
+
解決させたいことは、ウィンドウサイズを縮めた時に、jqueryの[prependTo]を実行したいのですが、
|
2
|
+
|
3
|
+
実行されません。
|
2
4
|
|
3
5
|
|
4
6
|
|
5
|
-
ま
|
7
|
+
原因は何かありますでしょうか。
|
6
|
-
|
7
|
-
通常のシンプルアコーディオンのように、addClassで、$(this).height()+"px");で高さをだすことは可能でしょうか。
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
```ここに言語を入力
|
12
12
|
|
13
|
+
$(function() {
|
13
14
|
|
15
|
+
$(window).on("resize", function() {
|
14
16
|
|
17
|
+
var tm;
|
18
|
+
|
19
|
+
clearTimeout(tm);
|
20
|
+
|
21
|
+
tm = setTimeout(function() {
|
22
|
+
|
23
|
+
if ($(window).width() < 736) {
|
24
|
+
|
25
|
+
location.reload(); // refresh page
|
26
|
+
|
15
|
-
|
27
|
+
$('#faq-cont-1').prependTo('#faq-ttl-1');
|
16
28
|
|
17
29
|
|
18
30
|
|
@@ -20,352 +32,22 @@
|
|
20
32
|
|
21
33
|
|
22
34
|
|
23
|
-
|
35
|
+
|
24
|
-
|
25
|
-
// Easy Responsive Tabs Plugin
|
26
|
-
|
27
|
-
// Author: Samson.Onna <Email : samson3d@gmail.com>
|
28
|
-
|
29
|
-
(function ($) {
|
30
|
-
|
31
|
-
$.fn.extend({
|
32
|
-
|
33
|
-
easyResponsiveTabs: function (options) {
|
34
|
-
|
35
|
-
//Set the default values, use comma to separate the settings, example:
|
36
|
-
|
37
|
-
var defaults = {
|
38
|
-
|
39
|
-
type: 'default', //default, vertical, accordion;
|
40
|
-
|
41
|
-
width: 'auto',
|
42
|
-
|
43
|
-
fit: true,
|
44
|
-
|
45
|
-
closed: false,
|
46
|
-
|
47
|
-
activate: function(){}
|
48
36
|
|
49
37
|
}
|
50
38
|
|
51
|
-
|
39
|
+
else {
|
52
40
|
|
53
|
-
var options = $.extend(defaults, options);
|
54
|
-
|
55
|
-
var opt = options, jtype = opt.type, jfit = opt.fit, jwidth = opt.width, vtabs = 'vertical', accord = 'accordion';
|
56
|
-
|
57
|
-
var hash = window.location.hash;
|
58
|
-
|
59
|
-
var historyApi = !!(window.history && history.replaceState);
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
//
|
41
|
+
// width more than 768px for PC
|
64
|
-
|
65
|
-
$(this).bind('tabactivate', function(e, currentTab) {
|
66
|
-
|
67
|
-
if(typeof options.activate === 'function') {
|
68
|
-
|
69
|
-
options.activate.call(currentTab, e)
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
});
|
74
42
|
|
75
43
|
|
76
44
|
|
77
|
-
|
45
|
+
}
|
78
46
|
|
79
|
-
this.each(function () {
|
80
|
-
|
81
|
-
var $respTabs = $(this);
|
82
|
-
|
83
|
-
var $respTabsList = $respTabs.find('ul.resp-tabs-list');
|
84
|
-
|
85
|
-
var respTabsId = $respTabs.attr('id');
|
86
|
-
|
87
|
-
$respTabs.find('ul.resp-tabs-list li').addClass('resp-tab-item');
|
88
|
-
|
89
|
-
$respTabs.css({
|
90
|
-
|
91
|
-
'display': 'block',
|
92
|
-
|
93
|
-
'width': jwidth
|
94
|
-
|
95
|
-
});
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
$respTabs.find('.resp-tabs-container > div').addClass('resp-tab-content');
|
100
|
-
|
101
|
-
jtab_options();
|
102
|
-
|
103
|
-
//Properties Function
|
104
|
-
|
105
|
-
function jtab_options() {
|
106
|
-
|
107
|
-
if (jtype == vtabs) {
|
108
|
-
|
109
|
-
$respTabs.addClass('resp-vtabs');
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
if (jfit == true) {
|
114
|
-
|
115
|
-
$respTabs.css({ width: '100%', margin: '0px' });
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
if (jtype == accord) {
|
120
|
-
|
121
|
-
$respTabs.addClass('resp-easy-accordion');
|
122
|
-
|
123
|
-
$respTabs.find('.resp-tabs-list').css('display', 'none');
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
//Assigning the h2 markup to accordion title
|
132
|
-
|
133
|
-
var $tabItemh2;
|
134
|
-
|
135
|
-
$respTabs.find('.resp-tab-content').before("<h2 class='resp-accordion' role='tab'></h2>");
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
var itemCount = 0;
|
140
|
-
|
141
|
-
$respTabs.find('.resp-accordion').each(function () {
|
142
|
-
|
143
|
-
$tabItemh2 = $(this);
|
144
|
-
|
145
|
-
var $tabItem = $respTabs.find('.resp-tab-item:eq(' + itemCount + ')');
|
146
|
-
|
147
|
-
var $accItem = $respTabs.find('.resp-accordion:eq(' + itemCount + ')');
|
148
|
-
|
149
|
-
$accItem.append($tabItem.html());
|
150
|
-
|
151
|
-
$accItem.data($tabItem.data());
|
152
|
-
|
153
|
-
$tabItemh2.attr('aria-controls', 'tab_item-' + (itemCount));
|
154
|
-
|
155
|
-
itemCount++;
|
156
|
-
|
157
|
-
});
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
//Assigning the 'aria-controls' to Tab items
|
162
|
-
|
163
|
-
var count = 0,
|
164
|
-
|
165
|
-
$tabContent;
|
166
|
-
|
167
|
-
$respTabs.find('.resp-tab-item').each(function () {
|
168
|
-
|
169
|
-
$tabItem = $(this);
|
170
|
-
|
171
|
-
$tabItem.attr('aria-controls', 'tab_item-' + (count));
|
172
|
-
|
173
|
-
$tabItem.attr('role', 'tab');
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
//Assigning the 'aria-labelledby' attr to tab-content
|
178
|
-
|
179
|
-
var tabcount = 0;
|
180
|
-
|
181
|
-
$respTabs.find('.resp-tab-content').each(function () {
|
182
|
-
|
183
|
-
$tabContent = $(this);
|
184
|
-
|
185
|
-
$tabContent.attr('aria-labelledby', 'tab_item-' + (tabcount));
|
186
|
-
|
187
|
-
tabcount++;
|
188
|
-
|
189
|
-
});
|
190
|
-
|
191
|
-
|
47
|
+
}, 250);
|
192
|
-
|
193
|
-
});
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
// Show correct content area
|
198
|
-
|
199
|
-
var tabNum = 0;
|
200
|
-
|
201
|
-
if(hash!='') {
|
202
|
-
|
203
|
-
var matches = hash.match(new RegExp(respTabsId+"([0-9]+)"));
|
204
|
-
|
205
|
-
if (matches!==null && matches.length===2) {
|
206
|
-
|
207
|
-
tabNum = parseInt(matches[1],10)-1;
|
208
|
-
|
209
|
-
if (tabNum > count) {
|
210
|
-
|
211
|
-
tabNum = 0;
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
//Active correct tab
|
222
|
-
|
223
|
-
$($respTabs.find('.resp-tab-item')[tabNum]).addClass('resp-tab-active');
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
//keep closed if option = 'closed' or option is 'accordion' and the element is in accordion mode
|
228
|
-
|
229
|
-
if(options.closed !== true && !(options.closed === 'accordion' && !$respTabsList.is(':visible')) && !(options.closed === 'tabs' && $respTabsList.is(':visible'))) {
|
230
|
-
|
231
|
-
$($respTabs.find('.resp-accordion')[tabNum]).addClass('resp-tab-active');
|
232
|
-
|
233
|
-
$($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active').attr('style', 'display:block');
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
//assign proper classes for when tabs mode is activated before making a selection in accordion mode
|
238
|
-
|
239
|
-
else {
|
240
|
-
|
241
|
-
$($respTabs.find('.resp-tab-content')[tabNum]).addClass('resp-tab-content-active resp-accordion-closed')
|
242
|
-
|
243
|
-
}
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
//Tab Click action function
|
248
|
-
|
249
|
-
$respTabs.find("[role=tab]").each(function () {
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
var $currentTab = $(this);
|
254
|
-
|
255
|
-
$currentTab.click(function () {
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
var $currentTab = $(this);
|
260
|
-
|
261
|
-
var $tabAria = $currentTab.attr('aria-controls');
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
if ($currentTab.hasClass('resp-accordion') && $currentTab.hasClass('resp-tab-active')) {
|
266
|
-
|
267
|
-
$respTabs.find('.resp-tab-content-active').slideUp('slow', function () { $(this).addClass('resp-accordion-closed'); });
|
268
|
-
|
269
|
-
$currentTab.removeClass('resp-tab-active');
|
270
|
-
|
271
|
-
return false;
|
272
|
-
|
273
|
-
}
|
274
|
-
|
275
|
-
if (!$currentTab.hasClass('resp-tab-active') && $currentTab.hasClass('resp-accordion')) {
|
276
|
-
|
277
|
-
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
|
278
|
-
|
279
|
-
$respTabs.find('.resp-tab-content-active').slideUp('slow').removeClass('resp-tab-content-active resp-accordion-closed');
|
280
|
-
|
281
|
-
$respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').slideDown('1350').addClass('resp-tab-content-active');
|
286
|
-
|
287
|
-
} else {
|
288
|
-
|
289
|
-
$respTabs.find('.resp-tab-active').removeClass('resp-tab-active');
|
290
|
-
|
291
|
-
$respTabs.find('.resp-tab-content-active').removeAttr('style').removeClass('resp-tab-content-active').removeClass('resp-accordion-closed');
|
292
|
-
|
293
|
-
$respTabs.find("[aria-controls=" + $tabAria + "]").addClass('resp-tab-active');
|
294
|
-
|
295
|
-
$respTabs.find('.resp-tab-content[aria-labelledby = ' + $tabAria + ']').addClass('resp-tab-content-active').attr('style', 'display:block');
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
//Trigger tab activation event
|
300
|
-
|
301
|
-
$currentTab.trigger('tabactivate', $currentTab);
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
//Update Browser History
|
306
|
-
|
307
|
-
if(historyApi) {
|
308
|
-
|
309
|
-
var currentHash = window.location.hash;
|
310
|
-
|
311
|
-
var newHash = respTabsId+(parseInt($tabAria.substring(9),10)+1).toString();
|
312
|
-
|
313
|
-
if (currentHash!="") {
|
314
|
-
|
315
|
-
var re = new RegExp(respTabsId+"[0-9]+");
|
316
|
-
|
317
|
-
if (currentHash.match(re)!=null) {
|
318
|
-
|
319
|
-
newHash = currentHash.replace(re,newHash);
|
320
|
-
|
321
|
-
}
|
322
|
-
|
323
|
-
else {
|
324
|
-
|
325
|
-
newHash = currentHash+"|"+newHash;
|
326
|
-
|
327
|
-
}
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
else {
|
332
|
-
|
333
|
-
newHash = '#'+newHash;
|
334
|
-
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
history.replaceState(null,null,newHash);
|
340
|
-
|
341
|
-
}
|
342
|
-
|
343
|
-
});
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
});
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
//Window resize function
|
352
|
-
|
353
|
-
$(window).resize(function () {
|
354
|
-
|
355
|
-
$respTabs.find('.resp-accordion-closed').removeAttr('style');
|
356
|
-
|
357
|
-
});
|
358
|
-
|
359
|
-
});
|
360
|
-
|
361
|
-
}
|
362
48
|
|
363
49
|
});
|
364
50
|
|
365
|
-
})
|
51
|
+
});
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
52
|
|
371
53
|
```
|