質問編集履歴
2
脱字
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
現在 Swiped.js というプラグインを使って、スマートフォン(タブレット)に対応したスワイプ機能を実装しようとしています。
|
6
6
|
|
7
|
-
右方向へある程度スワイプして動かした場合は、選択要素はすべて画面から消えるという機能(swipe to delete)を実装し
|
7
|
+
右方向へある程度スワイプして動かした場合は、選択要素はすべて画面から消えるという機能(swipe to delete)を実装したのですが、スワイプが終わったあと、残ったブロック要素が消えたブロック要素の分だけ上に詰めるように移動する際に
|
8
8
|
|
9
9
|
アニメーション効果で滑らかに移動するようにしたいのですが、なかなか上手く行きません。
|
10
10
|
|
@@ -16,13 +16,15 @@
|
|
16
16
|
|
17
17
|
[リンク内容](https://github.com/mishk0/swiped)
|
18
18
|
|
19
|
+
https://github.com/mishk0/swiped
|
20
|
+
|
19
21
|
|
20
22
|
|
21
23
|
### 発生している問題
|
22
24
|
|
23
|
-
スワイプ後に残りの要素が上に移動するが、そのスピードを変更できません。何か助言を頂ければと思っております。また、
|
25
|
+
スワイプ後に残りの要素が上に移動するが、そのスピードを変更できません。何か助言を頂ければと思っております。また、スピードを変更することが出来る他のプラグインなどがあった場合、そちらを教えていただければ幸いです。
|
24
26
|
|
25
|
-
とても初歩的な質問をしてしまい申し訳ありませんが、どなたか力を貸して頂ける助かります。
|
27
|
+
とても初歩的な質問をしてしまい申し訳ありませんが、どなたか力を貸して頂けると助かります。
|
26
28
|
|
27
29
|
宜しくお願い致します。
|
28
30
|
|
1
ソースコードを載せたかったのですが、文字数オーバーのため載せることが出来なかったので割愛しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,14 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
カスタマイズの対象は次のライブラリです:
|
14
|
+
|
15
|
+
Swiped.js
|
16
|
+
|
17
|
+
[リンク内容](https://github.com/mishk0/swiped)
|
18
|
+
|
19
|
+
|
20
|
+
|
13
21
|
### 発生している問題
|
14
22
|
|
15
23
|
スワイプ後に残りの要素が上に移動するが、そのスピードを変更できません。何か助言を頂ければと思っております。また、他のスピードを変更することが出来るプラグインなどがあった場合、そちらを教えていただければ幸いです。
|
@@ -17,432 +25,6 @@
|
|
17
25
|
とても初歩的な質問をしてしまい申し訳ありませんが、どなたか力を貸して頂ける助かります。
|
18
26
|
|
19
27
|
宜しくお願い致します。
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
### コード
|
26
|
-
|
27
|
-
```ここに言語を入力
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
<!DOCTYPE html>
|
32
|
-
|
33
|
-
<html lang="ja"><head>
|
34
|
-
|
35
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
36
|
-
|
37
|
-
<link rel="stylesheet" href="style.css" type="text/css" media="all">
|
38
|
-
|
39
|
-
<title>サンプル</title>
|
40
|
-
|
41
|
-
</head>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div class="lo-wrapper-outer wrapper-outer all" id="ptop" ontouchstart="">
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
<main id="js-main">
|
54
|
-
|
55
|
-
<div class="lo-main-outer main-outer" id="js-main-outer">
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<div id="js-index-menu-list-outer" class="not-provided" style="display: block;">
|
60
|
-
|
61
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="01" id="order01">
|
62
|
-
|
63
|
-
<div class="serve-list">
|
64
|
-
|
65
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー01</div>
|
66
|
-
|
67
|
-
</div>
|
68
|
-
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="02" id="order02">
|
72
|
-
|
73
|
-
<div class="serve-list">
|
74
|
-
|
75
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー02</div>
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="03" id="order03">
|
82
|
-
|
83
|
-
<div class="serve-list">
|
84
|
-
|
85
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー03</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="04" id="order04">
|
92
|
-
|
93
|
-
<div class="serve-list">
|
94
|
-
|
95
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー04</div>
|
96
|
-
|
97
|
-
</div>
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="05" id="order05">
|
102
|
-
|
103
|
-
<div class="serve-list">
|
104
|
-
|
105
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー05</div>
|
106
|
-
|
107
|
-
</div>
|
108
|
-
|
109
|
-
</div>
|
110
|
-
|
111
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="06" id="order06">
|
112
|
-
|
113
|
-
<div class="serve-list">
|
114
|
-
|
115
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー06</div>
|
116
|
-
|
117
|
-
</div>
|
118
|
-
|
119
|
-
</div>
|
120
|
-
|
121
|
-
<div class="section-ptn-a skin-table js-swipe-to-delete js-menu-item" data-index="07" id="order07">
|
122
|
-
|
123
|
-
<div class="serve-list">
|
124
|
-
|
125
|
-
<div class="js-swipe-at-once-hdl">メニューメニューメニューメニューメニュー07</div>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
</div>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
</div>
|
134
|
-
|
135
|
-
</div>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<div><input type="button" value=" 一括スワイプモードを抜ける" id="js-escape-swipe-at-once-mode">
|
140
|
-
|
141
|
-
</div>
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
</div><!--/lo-main-outer-->
|
146
|
-
|
147
|
-
</main>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
</div><!--/lo-wrapper-outer-->
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<script src="index_files/jquery.js"></script>
|
156
|
-
|
157
|
-
<script src="index_files/swiped.js"></script>
|
158
|
-
|
159
|
-
<script src="index_files/proc.js"></script>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
</body></html>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
```
|
178
|
-
|
179
|
-
### ファイル名[swiped.js] *これはオリジナルのswiped-original.jsをカスタマイズしたもの
|
180
|
-
|
181
|
-
```ここに言語を入力
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
(function() {
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
/**
|
200
|
-
|
201
|
-
* Animation of the closing
|
202
|
-
|
203
|
-
*/
|
204
|
-
|
205
|
-
Swiped.prototype.close = function(isForce) {
|
206
|
-
|
207
|
-
this.animation(0);
|
208
|
-
|
209
|
-
this.swiped = false;
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
if (!isForce) {
|
214
|
-
|
215
|
-
this.transitionEnd(this.elem, this.onClose);
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
this.resetValue();
|
222
|
-
|
223
|
-
};
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
/**
|
230
|
-
|
231
|
-
* reset to initial values
|
232
|
-
|
233
|
-
*/
|
234
|
-
|
235
|
-
Swiped.prototype.resetValue = function() {
|
236
|
-
|
237
|
-
this.startSwipe = false;
|
238
|
-
|
239
|
-
this.startScroll = false;
|
240
|
-
|
241
|
-
this.delta = 0;
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
// added by pretacou : 2019/06
|
246
|
-
|
247
|
-
//this.comps = [];
|
248
|
-
|
249
|
-
};
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
Swiped.prototype.animation = function(x, duration) {
|
258
|
-
|
259
|
-
duration = duration === undefined ? this.duration : duration;
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
this.elem.style.cssText = cssProps.transition + ':' + cssProps.transform + ' ' + duration + 'ms; ' +
|
264
|
-
|
265
|
-
cssProps.transform + ':' + 'translate3d(' + x + 'px, 0px, 0px)';
|
266
|
-
|
267
|
-
};
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
Swiped.prototype.updatePos = function(dir, delta) {
|
272
|
-
|
273
|
-
this.dir = dir;
|
274
|
-
|
275
|
-
this.delta = delta;
|
276
|
-
|
277
|
-
};
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
Swiped.prototype.destroy = function(isRemoveNode) {
|
282
|
-
|
283
|
-
var id = this.id;
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
Swiped._elems.forEach(function(elem, i) {
|
288
|
-
|
289
|
-
if (elem.id === id) {
|
290
|
-
|
291
|
-
Swiped._elems.splice(i,0);
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
});
|
296
|
-
|
297
|
-
};
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
})();
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
```
|
308
|
-
|
309
|
-
### ファイル[proc.js]
|
310
|
-
|
311
|
-
```ここに言語を入力
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
$(function () {
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
// swipe のイベント
|
320
|
-
|
321
|
-
function reset_swiped()
|
322
|
-
|
323
|
-
{
|
324
|
-
|
325
|
-
if (g_swipe) delete g_swipe;
|
326
|
-
|
327
|
-
g_swipe = null;
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
g_swipe = Swiped.init({
|
332
|
-
|
333
|
-
query: '.js-swipe-to-delete',
|
334
|
-
|
335
|
-
duration:10,
|
336
|
-
|
337
|
-
left: 400,
|
338
|
-
|
339
|
-
right: 400,
|
340
|
-
|
341
|
-
onOpen: function() {
|
342
|
-
|
343
|
-
if (this.dir == 1) { // only for right direction
|
344
|
-
|
345
|
-
if (false) {
|
346
|
-
|
347
|
-
// 本サンプルではこちらは無視する
|
348
|
-
|
349
|
-
} else {
|
350
|
-
|
351
|
-
var tgt = this;
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
if (g_swipe_at_once_mode) {
|
356
|
-
|
357
|
-
// 消す
|
358
|
-
|
359
|
-
tgt.destroyAtOnce(true);
|
360
|
-
|
361
|
-
} else {
|
362
|
-
|
363
|
-
// 消す
|
364
|
-
|
365
|
-
tgt.destroy(true);
|
366
|
-
|
367
|
-
}
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
// 一括モードを抜ける
|
372
|
-
|
373
|
-
quit_swipe_at_once_mode();
|
374
|
-
|
375
|
-
return;
|
376
|
-
|
377
|
-
}
|
378
|
-
|
379
|
-
} else {
|
380
|
-
|
381
|
-
Swiped._closeAll(this.group);
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
},
|
386
|
-
|
387
|
-
onClose: function() {
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
},
|
392
|
-
|
393
|
-
});
|
394
|
-
|
395
|
-
}
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
// 一括スワイプモードから抜ける
|
400
|
-
|
401
|
-
// 同時に同一メニューモードからも抜ける
|
402
|
-
|
403
|
-
// この2つは必ず同時に抜ける
|
404
|
-
|
405
|
-
function quit_swipe_at_once_mode()
|
406
|
-
|
407
|
-
{
|
408
|
-
|
409
|
-
if (!g_swipe_at_once_mode) return;
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
$("#js-index-menu-list-outer").find(".js-menu-item").each( function() {
|
414
|
-
|
415
|
-
$(this).removeClass("inactive");
|
416
|
-
|
417
|
-
$(this).removeClass("js-swipe-at-once");
|
418
|
-
|
419
|
-
$(this).addClass("js-swipe-to-delete");
|
420
|
-
|
421
|
-
$(this).show();
|
422
|
-
|
423
|
-
});
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
$("body").css("background-color", "#FFF");
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
g_swipe_at_once_mode = false;
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
});
|
444
|
-
|
445
|
-
```
|
446
28
|
|
447
29
|
|
448
30
|
|