質問編集履歴

1

htmlとjsを追加しました。

2017/10/05 01:10

投稿

takane
takane

スコア63

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,667 @@
21
21
 
22
22
 
23
23
  何かよ方法はないでしょうか?
24
+
25
+ ---追加--
26
+
27
+
28
+
29
+ すみません。
30
+
31
+ 全体のコードを記載いたします。
32
+
33
+
34
+
35
+
36
+
37
+ ```html
38
+
39
+ <!DOCTYPE html>
40
+
41
+ <html>
42
+
43
+ <head>
44
+
45
+ <meta charset="utf-8">
46
+
47
+ <title>ADOBEヘルプ</title>
48
+
49
+ <style>
50
+
51
+ body{
52
+
53
+ padding: 0;
54
+
55
+ margin: 0;
56
+
57
+ }
58
+
59
+ h1{
60
+
61
+ text-align: center;
62
+
63
+ }
64
+
65
+ h2{
66
+
67
+ margin: 0;
68
+
69
+ padding: 0;
70
+
71
+ }
72
+
73
+ .explain{background-color: #000}
74
+
75
+ li{
76
+
77
+ list-style: none;
78
+
79
+ }
80
+
81
+ .mark {
82
+
83
+ height: 330px;
84
+
85
+ }
86
+
87
+ .window{
88
+
89
+ width: 200px;
90
+
91
+ margin: 0 auto;
92
+
93
+ overflow: hidden;
94
+
95
+ }
96
+
97
+ #aplication{
98
+
99
+ display: flex;
100
+
101
+ padding: 0;
102
+
103
+ }
104
+
105
+ #aplication li {
106
+
107
+ margin-left: 20px;
108
+
109
+ }
110
+
111
+ #aplication li:first-child{
112
+
113
+ margin-left: -440px;
114
+
115
+ }
116
+
117
+ #aplication li img{
118
+
119
+ width: 200px;
120
+
121
+ height:200px;
122
+
123
+ }
124
+
125
+ #back img,#next img{
126
+
127
+ margin: 50% 0;
128
+
129
+ }
130
+
131
+ .slide{
132
+
133
+ display: flex;
134
+
135
+ }
136
+
137
+ .next{
138
+
139
+ transition: .8s;
140
+
141
+ transform: translateX(-220px);
142
+
143
+ }
144
+
145
+ .back{
146
+
147
+ transition: .8s;
148
+
149
+ transform: translateX(220px);
150
+
151
+ }
152
+
153
+ .explain{
154
+
155
+ padding: 30px;
156
+
157
+ box-sizing: border-box;
158
+
159
+ }
160
+
161
+ .explain_tab{
162
+
163
+ background-color: #fff;
164
+
165
+ border-radius: 10px;
166
+
167
+ padding: 15px;
168
+
169
+ box-sizing: border-box;
170
+
171
+ display: none;
172
+
173
+ transition: .4s;
174
+
175
+ }
176
+
177
+ .explain_tab h2{
178
+
179
+ text-align: center;
180
+
181
+ }
182
+
183
+ .explain_tab.active{
184
+
185
+ opacity: 0;
186
+
187
+ display: block;
188
+
189
+ }
190
+
191
+ .explain_tab.sol{
192
+
193
+ opacity: 1;
194
+
195
+ transition: .4s;
196
+
197
+ }
198
+
199
+ .explain_tab.op{
200
+
201
+ transition: .4s;
202
+
203
+ opacity: 0;
204
+
205
+ }
206
+
207
+
208
+
209
+ /*--説明部分--*/
210
+
211
+ .explain_tab ul {
212
+
213
+ margin-top: 30px;
214
+
215
+ padding: 0;
216
+
217
+ }
218
+
219
+ .explain_tab h2{
220
+
221
+ margin-top: 20px;
222
+
223
+ }
224
+
225
+ .button{
226
+
227
+ margin-bottom: 0px;
228
+
229
+ font-size: 18px;
230
+
231
+ font-weight: bold;
232
+
233
+ text-align: center;
234
+
235
+ padding: 0;
236
+
237
+ background-color: #ddd;
238
+
239
+ padding: 15px;
240
+
241
+ border-radius: 10px;
242
+
243
+ border: 1px #000 solid;
244
+
245
+ box-sizing: border-box;
246
+
247
+ text-decoration:underline;
248
+
249
+ }
250
+
251
+ .explain_contents{
252
+
253
+ padding: 20px 50px 0;
254
+
255
+ }
256
+
257
+ .explain_contents.active{
258
+
259
+
260
+
261
+ }
262
+
263
+ .ac{
264
+
265
+ height: 59px;
266
+
267
+ overflow:hidden;
268
+
269
+ transition: .8s;
270
+
271
+ }
272
+
273
+ .button:hover{
274
+
275
+ cursor: pointer;
276
+
277
+ }
278
+
279
+ .listMark li{
280
+
281
+ list-style: disc;
282
+
283
+ }
284
+
285
+ /*--説明部分end--*/
286
+
287
+ </style>
288
+
289
+ </head>
290
+
291
+ <body>
292
+
293
+ <main>
294
+
295
+ <div class="mark">
296
+
297
+ <h1>ADOBEヘルプ</h1>
298
+
299
+ <div class="slide" id="slide">
300
+
301
+ <div id="back">
302
+
303
+ <img src="images/back.png" alt="back">
304
+
305
+ </div>
306
+
307
+ <div id="middle">
308
+
309
+ <div class="window">
310
+
311
+ <ul id="aplication">
312
+
313
+
314
+
315
+ </ul>
316
+
317
+ </div>
318
+
319
+ </div>
320
+
321
+
322
+
323
+ <div id="next">
324
+
325
+ <img src="images/next.png" alt="next">
326
+
327
+ </div>
328
+
329
+ </div>
330
+
331
+
332
+
333
+ </div>
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+ </main>
342
+
343
+ <script>
344
+
345
+ (function () {
346
+
347
+ var apli =
348
+
349
+ [
350
+
351
+ {'img':'images/ps_cc_app_RGB.svg','nunber':'tab_ps'},
352
+
353
+ {'img':'images/ai_cc_app_RGB.svg','nunber':'tab_ai'},
354
+
355
+ {'img':'images/Lr_cc_app_noshadow_RGB.svg','nunber':'tab_lr'},
356
+
357
+ {'img':'images/st_app_RGB.svg','nunber':'tab_st'},
358
+
359
+ {'img':'images/id_cc_app_RGB.svg','nunber':'tab_id'}
360
+
361
+ ];
362
+
363
+
364
+
365
+ var aplication = document.getElementById('aplication');
366
+
367
+ var box = [];//変数の並びをかえるための一時格納ボックス
368
+
369
+ var currentApli;//現在選択されているアプリケーションを記載しておく
370
+
371
+
372
+
373
+ var sw = false;
374
+
375
+
376
+
377
+ //アプリ画像をドラッグした時の挙動
378
+
379
+
380
+
381
+ var touchList = aplication.getElementsByTagName('li');
382
+
383
+ console.log(touchList);
384
+
385
+ for (var i = 0; i < touchList.length; i++) {
386
+
387
+ touchList[i].getElementsByTagName('img');
388
+
389
+
390
+
391
+ touchList[i].addEventListener('mousedown',function () {
392
+
393
+ console.log('ok');
394
+
395
+ })
396
+
397
+ }
398
+
399
+ //変数に入れた画像データをリストに格納し表示
400
+
401
+
402
+
403
+ //スライド部分の配置をずらす(配列の先頭を出す)
404
+
405
+ for (var i = 0; i < 2; i++) {
406
+
407
+ box.push(apli.pop());
408
+
409
+ apli.unshift(box.shift());
410
+
411
+ }
412
+
413
+
414
+
415
+ for (var i = 0; i < 5; i++) {
416
+
417
+ var li = document.createElement("li");
418
+
419
+ var img = document.createElement("img");
420
+
421
+ li.dataset.id = apli[i].nunber;
422
+
423
+ var imagebox = aplication.appendChild(li).appendChild(img);
424
+
425
+ imagebox.src = apli[i].img;
426
+
427
+ }
428
+
429
+
430
+
431
+
432
+
433
+ //スライド部分のwidth調整、explain部分の高さ調整
434
+
435
+ window.onresize = ws;
436
+
437
+ function ws() {
438
+
439
+ var w = window.innerWidth;
440
+
441
+ document.getElementById('slide').style.width = w + "px";
442
+
443
+ document.getElementById('middle').style.width = w - 200 + "px";
444
+
445
+ var h = window.innerHeight;
446
+
447
+ document.getElementsByClassName('explain')[0].style.minHeight = h - 360 + 'px';
448
+
449
+ }
450
+
451
+ ws();
452
+
453
+
454
+
455
+ //スライド用
456
+
457
+ document.getElementById('next').addEventListener('click',function functionName() {
458
+
459
+ if (sw === false) {
460
+
461
+ next();
462
+
463
+ changeTab();
464
+
465
+ }else if (sw = true) {
466
+
467
+ return;
468
+
469
+ }
470
+
471
+ });
472
+
473
+ document.getElementById('back').addEventListener('click',function functionName() {
474
+
475
+ if (sw === false) {
476
+
477
+ back();
478
+
479
+ changeTab();
480
+
481
+ }else if (sw = true) {
482
+
483
+ return;
484
+
485
+ }
486
+
487
+ });
488
+
489
+
490
+
491
+ function changeTab() {
492
+
493
+ var deleteTab = document.getElementsByClassName('explain_tab');
494
+
495
+ for (var i = 0; i < deleteTab.length; i++) {
496
+
497
+ if (deleteTab[i].className === 'sol active explain_tab') {
498
+
499
+ deleteTab[i].className = 'op active explain_tab';
500
+
501
+ }
502
+
503
+ };
504
+
505
+ setTimeout(function () {
506
+
507
+ for (var i = 0; i < deleteTab.length; i++) {
508
+
509
+ deleteTab[i].className = 'op explain_tab';
510
+
511
+ document.getElementById(currentApli).className = 'op active explain_tab';
512
+
513
+ };
514
+
515
+ setTimeout(function () {
516
+
517
+ document.getElementById(currentApli).className = 'sol active explain_tab';
518
+
519
+ }, 5);
520
+
521
+ }, 395);
522
+
523
+ };
524
+
525
+
526
+
527
+ function next() {
528
+
529
+ sw = true;
530
+
531
+ aplication.className = 'next';
532
+
533
+ box.push(apli.shift());
534
+
535
+ apli.push(box.shift());
536
+
537
+ currentApli = apli[2].nunber;
538
+
539
+ setTimeout(function () {
540
+
541
+
542
+
543
+ while (aplication.firstChild) {
544
+
545
+ aplication.removeChild(aplication.firstChild);
546
+
547
+ };
548
+
549
+ aplication.className = '';
550
+
551
+ for (var i = 0; i < 5; i++) {
552
+
553
+ var li = document.createElement("li");
554
+
555
+ var img = document.createElement("img");
556
+
557
+ var imagebox = aplication.appendChild(li).appendChild(img);
558
+
559
+ imagebox.src = apli[i].img;
560
+
561
+ }
562
+
563
+ sw = false;
564
+
565
+ }, 800);
566
+
567
+ initButton();
568
+
569
+ };
570
+
571
+ function back() {
572
+
573
+ sw = true;
574
+
575
+ aplication.className = 'back';
576
+
577
+ box.push(apli.pop());
578
+
579
+ apli.unshift(box.shift());
580
+
581
+ currentApli = apli[2].nunber;
582
+
583
+
584
+
585
+ setTimeout(function () {
586
+
587
+
588
+
589
+ while (aplication.firstChild) {
590
+
591
+ aplication.removeChild(aplication.firstChild);
592
+
593
+ };
594
+
595
+ aplication.className = '';
596
+
597
+ for (var i = 0; i < 5; i++) {
598
+
599
+ var li = document.createElement("li");
600
+
601
+ var img = document.createElement("img");
602
+
603
+ var imagebox = aplication.appendChild(li).appendChild(img);
604
+
605
+ imagebox.src = apli[i].img;
606
+
607
+ }
608
+
609
+ sw = false;
610
+
611
+ }, 800);
612
+
613
+ initButton();
614
+
615
+ };
616
+
617
+
618
+
619
+
620
+
621
+ var buttonL = document.getElementsByClassName('button');
622
+
623
+ var cont = document.getElementsByClassName('explain_contents');
624
+
625
+ var ac = document.getElementsByClassName('ac');
626
+
627
+ var acSw = [] ;//アコーディオン開閉のスイッチ
628
+
629
+
630
+
631
+ for (var i = 0; i < buttonL.length; i++) {
632
+
633
+ acSw.push(false);
634
+
635
+ clickButton(i);
636
+
637
+ }
638
+
639
+ function clickButton(n) {
640
+
641
+ buttonL[n].addEventListener('click',function () {
642
+
643
+ if (acSw[n] === false) {
644
+
645
+ var contH = cont[n].clientHeight;
646
+
647
+ var acH = ac[n].clientHeight;
648
+
649
+ ac[n].style.height = acH + contH + 'px';
650
+
651
+ acSw[n] = true;
652
+
653
+ }else if (acSw[n] === true) {
654
+
655
+ ac[n].style.height = '59px';
656
+
657
+ acSw[n] = false;
658
+
659
+ }
660
+
661
+ })
662
+
663
+ };
664
+
665
+ function initButton() {
666
+
667
+ for (var i = 0; i < buttonL.length; i++) {
668
+
669
+ ac[i].style.height = '59px';
670
+
671
+ acSw[i] = false;
672
+
673
+ };
674
+
675
+ };
676
+
677
+ })();
678
+
679
+
680
+
681
+ </script>
682
+
683
+ </body>
684
+
685
+ </html>
686
+
687
+ ```