質問編集履歴
3
回答者様のアドバイスを受けて編集しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -318,11 +318,185 @@
|
|
318
318
|
|
319
319
|
ライブラリは Yahoo! YUI Libraryを使用しています
|
320
320
|
|
321
|
+
//回答を受けて再び編集しました
|
322
|
+
|
323
|
+
協力していただきたけると助かります
|
324
|
+
|
325
|
+
//ロード
|
326
|
+
|
327
|
+
YAHOO.util.Event.addListener(window, "load", function(){
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
//家具の配列データ
|
336
|
+
|
337
|
+
var kagu =['contents1','contents2','contents3','contents4','contents5'];
|
338
|
+
|
339
|
+
//kagu[0]→ 本棚です
|
340
|
+
|
341
|
+
var ddObj = new YAHOO.util.DD(kagu[0]);
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
//X軸とY軸の指定
|
346
|
+
|
347
|
+
//フローリング規定 X300 Y322
|
348
|
+
|
349
|
+
ddObj.setXConstraint(0, 400, 10);
|
350
|
+
|
351
|
+
ddObj.setYConstraint(0, 400, 10);
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
var ddObj2 = new YAHOO.util.DD(kagu[1]);
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
ddObj2.setXConstraint(0, 400, 10);
|
360
|
+
|
361
|
+
ddObj2.setYConstraint(0, 400, 10);
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
var ddObj3 = new YAHOO.util.DD(kagu[2]);
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
ddObj3.setXConstraint(0, 400, 10);
|
372
|
+
|
373
|
+
ddObj3.setYConstraint(0, 400, 10);
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
var ddObj4 = new YAHOO.util.DD(kagu[3]);
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
ddObj4.setXConstraint(0, 400, 10);
|
384
|
+
|
385
|
+
ddObj4.setYConstraint(0, 400, 10);
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
var ddObj5 = new YAHOO.util.DD(kagu[4]);
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
ddObj5.setXConstraint(0, 400, 10);
|
394
|
+
|
395
|
+
ddObj5.setYConstraint(0, 400, 10);
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
// 家具の追加オブジャクト
|
400
|
+
|
401
|
+
});
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
//家具配列データ
|
406
|
+
|
407
|
+
var kagu =['contents1','contents2','contents3','contents4','contents5'];
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
//ボタン機能
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
//スタートボタン
|
418
|
+
|
419
|
+
function btn(){
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
document.getElementById(kagu[0]).style.left = "0px";
|
424
|
+
|
425
|
+
document.getElementById(kagu[1]).style.left = "80px";
|
426
|
+
|
427
|
+
document.getElementById(kagu[2]).style.left = "160px";
|
428
|
+
|
429
|
+
document.getElementById(kagu[3]).style.left = "240px";
|
430
|
+
|
431
|
+
document.getElementById(kagu[4]).style.left = "320px";
|
432
|
+
|
433
|
+
}
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
//商品一覧から画面遷移ボタン
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
function btn0(){
|
442
|
+
|
443
|
+
document.getElementById(kagu[0]).style.left = 'visible';
|
444
|
+
|
445
|
+
}
|
446
|
+
|
447
|
+
function btn1(){
|
448
|
+
|
449
|
+
document.getElementById(kagu[1]).style.left = "80px";
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
}
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
function btn2(){
|
458
|
+
|
459
|
+
document.getElementById(kagu[2]).style.left = "160px";
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
}
|
464
|
+
|
465
|
+
function btn3(){
|
466
|
+
|
467
|
+
document.getElementById(kagu[3]).style.left = "240px";
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
}
|
472
|
+
|
473
|
+
function btn4(){
|
474
|
+
|
475
|
+
document.getElementById(kagu[4]).style.left = "320px";
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
}
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
// 追加 ☆ 質問する場所 エラーが起こっている場所 複製ボタン
|
492
|
+
|
321
493
|
|
322
494
|
|
323
495
|
YAHOO.util.Event.addLister(window,"load",moveItems)
|
324
496
|
|
325
|
-
|
497
|
+
|
498
|
+
|
499
|
+
|
326
500
|
|
327
501
|
|
328
502
|
|
@@ -336,93 +510,129 @@
|
|
336
510
|
|
337
511
|
|
338
512
|
|
513
|
+
//なんかの処理→移動制限
|
514
|
+
|
515
|
+
var ddObj = new YAHOO.util.DD("targetID");
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
ddObj.setXConstraint(0, 322, 10);
|
520
|
+
|
521
|
+
ddObj.setYConstraint(0, 300, 10);
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
var ddObj7 = new YAHOO.util.DD("clone1");
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
ddObj7.setXConstraint(0, 322, 10);
|
534
|
+
|
535
|
+
ddObj7.setYConstraint(0, 300, 10);
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
var ddObj8 = new YAHOO.util.DD("clone2");
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
ddObj8.setXConstraint(0, 322, 10);
|
544
|
+
|
545
|
+
ddObj8.setYConstraint(0, 300, 10);
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
var ddObj9 = new YAHOO.util.DD("clone3");
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
ddObj9.setXConstraint(0, 322, 10);
|
556
|
+
|
557
|
+
ddObj9.setYConstraint(0, 300, 10);
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
var ddObj10 = new YAHOO.util.DD("clone4");
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
ddObj10.setXConstraint(0, 322, 10);
|
570
|
+
|
571
|
+
ddObj10.setYConstraint(0, 300, 10);
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
}
|
580
|
+
|
339
581
|
|
340
582
|
|
583
|
+
// 家具の追加オブジャクト
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
//回答者様に教えてもらったところ
|
588
|
+
|
589
|
+
function cloneElement(furniture,kaguInd){
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
/*furnitureは種類として
|
594
|
+
|
595
|
+
kaguIndは添え字として配列としてデータを格納するべきなのか?*/
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
//既存の家具をコピーする
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
//kagu[0]のcloneを作りたい場合?は具体例があると助かります!
|
608
|
+
|
609
|
+
//kagu[0]は本棚です
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
/*kagu[0]は?となった場合は一番最初のコードに記載している
|
614
|
+
|
615
|
+
既存の本棚のデータです
|
616
|
+
|
617
|
+
既存の本棚のクローンを作る具体例をよろしくお願いします!*/
|
618
|
+
|
341
|
-
|
619
|
+
const tpl = document.getElementById(kagu[kaguInd]);
|
342
|
-
|
343
|
-
|
344
|
-
|
620
|
+
|
345
|
-
|
621
|
+
const clone = tpl.cloneNode(true);
|
346
|
-
|
347
|
-
ddObj6.setYConstraint(0, 300, 10);
|
348
622
|
|
349
623
|
|
350
624
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
625
|
+
const targetIDPrefix = furniture + "clone";
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
626
|
+
|
360
|
-
|
361
|
-
ddObj7.setYConstraint(0, 300, 10);
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
var ddObj8 = new YAHOO.util.DD("clone2");
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
ddObj8.setXConstraint(0, 322, 10);
|
370
|
-
|
371
|
-
ddObj8.setYConstraint(0, 300, 10);
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
var ddObj9 = new YAHOO.util.DD("clone3");
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
ddObj9.setXConstraint(0, 322, 10);
|
382
|
-
|
383
|
-
ddObj9.setYConstraint(0, 300, 10);
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
var ddObj10 = new YAHOO.util.DD("clone4");
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
ddObj10.setXConstraint(0, 322, 10);
|
396
|
-
|
397
|
-
ddObj10.setYConstraint(0, 300, 10);
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
}
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
// 家具の追加オブジャクト
|
416
|
-
|
417
|
-
function cloneElement(){
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
//既存の家具をコピーする
|
422
|
-
|
423
|
-
const
|
627
|
+
const suffix = document.querySelectorAll('[id^='+targetIDPrefix+']').length;
|
628
|
+
|
629
|
+
|
630
|
+
|
424
|
-
|
631
|
+
// ~Clone0とか~Clone1みたいに後ろの数字が要素の数に応じて増えていく
|
632
|
+
|
425
|
-
c
|
633
|
+
clone.id = targetIDPrefix + suffix;
|
634
|
+
|
635
|
+
|
426
636
|
|
427
637
|
|
428
638
|
|
@@ -430,7 +640,7 @@
|
|
430
640
|
|
431
641
|
// idとdisplayの設定
|
432
642
|
|
433
|
-
clone.id = "clone";
|
643
|
+
clone.id = furniture+"clone";
|
434
644
|
|
435
645
|
clone.class = "sample";
|
436
646
|
|
@@ -442,7 +652,17 @@
|
|
442
652
|
|
443
653
|
//クローンにマウスドラックイベントを追加する
|
444
654
|
|
445
|
-
clone.addEventListener("drag",
|
655
|
+
clone.addEventListener("drag",function(){
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
moveItems(this.id);
|
662
|
+
|
663
|
+
});
|
664
|
+
|
665
|
+
|
446
666
|
|
447
667
|
|
448
668
|
|
@@ -452,208 +672,16 @@
|
|
452
672
|
|
453
673
|
base.appendChild(clone);
|
454
674
|
|
455
|
-
|
456
|
-
|
457
|
-
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
458
680
|
|
459
681
|
}
|
460
682
|
|
461
683
|
|
462
684
|
|
463
|
-
function cloneElement1(){
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
//追加しました
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
const tpl = document.getElementById(kagu[1]);
|
474
|
-
|
475
|
-
const clone1 = tpl.cloneNode(true);
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
// idとdisplayの設定
|
482
|
-
|
483
|
-
clone1.id = "clone1";
|
484
|
-
|
485
|
-
clone1.class = "sample";
|
486
|
-
|
487
|
-
clone1.style.left ="0px";
|
488
|
-
|
489
|
-
clone1.style.display ="block";
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
clone1.addEventListener("drag",moveItems)
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
// フローリングに表示
|
502
|
-
|
503
|
-
base = document.getElementById('box1')
|
504
|
-
|
505
|
-
base.appendChild(clone1);
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
}
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
function cloneElement2(){
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
const tpl = document.getElementById(kagu[2]);
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
const clone2 = tpl.cloneNode(true);
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
// idとdisplayの設定
|
530
|
-
|
531
|
-
clone2.id = "clone2";
|
532
|
-
|
533
|
-
clone2.class = "sample";
|
534
|
-
|
535
|
-
clone2.style.left ="0px";
|
536
|
-
|
537
|
-
clone2.style.display ="block";
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
clone2.addEventListener("drag",moveItems)
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
// フローリングに表示
|
548
|
-
|
549
|
-
base = document.getElementById('box1')
|
550
|
-
|
551
|
-
base.appendChild(clone2);
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
}
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
function cloneElement3(){
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
const tpl = document.getElementById(kagu[3]);
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
const clone3 = tpl.cloneNode(true);
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
// idとdisplayの設定
|
580
|
-
|
581
|
-
clone3.id = "clone3";
|
582
|
-
|
583
|
-
clone3.class = "sample";
|
584
|
-
|
585
|
-
clone3.style.left ="0px";
|
586
|
-
|
587
|
-
clone3.style.display ="block";
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
clone3.addEventListener("drag",moveItems)
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
// フローリングに表示
|
598
|
-
|
599
|
-
base = document.getElementById('box1')
|
600
|
-
|
601
|
-
base.appendChild(clone3);
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
}
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
function cloneElement4(){
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
const tpl = document.getElementById(kagu[4]);
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
const clone4 = tpl.cloneNode(true);
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
// idとdisplayの設定
|
626
|
-
|
627
|
-
clone4.id = "clone4";
|
628
|
-
|
629
|
-
clone4.class = "sample";
|
630
|
-
|
631
|
-
clone4.style.left ="0px";
|
632
|
-
|
633
|
-
clone4.style.display ="block";
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
clone4.addEventListener("drag",moveItems)
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
// フローリングに表示
|
644
|
-
|
645
|
-
base = document.getElementById('box1')
|
646
|
-
|
647
|
-
base.appendChild(clone4);
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
}
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
685
|
```
|
658
686
|
|
659
687
|
|
2
ソースコードをさらに追加しました協力していただきたけると助かります!
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,9 +92,91 @@
|
|
92
92
|
|
93
93
|
</div>
|
94
94
|
|
95
|
-
|
95
|
+
<div class="menu-card">
|
96
|
+
|
96
|
-
|
97
|
+
<div class="menu-card-inner">
|
98
|
+
|
97
|
-
|
99
|
+
<img class="menu-image" src="./images/trend_20150716131537.jpg" alt="家具1">
|
100
|
+
|
101
|
+
<h3 class="menu-title">テレビ<br>
|
102
|
+
|
103
|
+
27000円</h3>
|
104
|
+
|
105
|
+
<button class ="btn" onclick="document.getElementById('contents2').style.visibility = 'visible';">クリック</button>
|
106
|
+
|
107
|
+
<button class ="btn" onclick="cloneElement1();stopclone()">追加</button>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<div class="menu-card">
|
118
|
+
|
119
|
+
<div class="menu-card-inner">
|
120
|
+
|
121
|
+
<img class="menu-image" src="./images/1b71e2b924b8a56374648cb8efdc1958.jpg" alt="家具1">
|
122
|
+
|
123
|
+
<h3 class="menu-title">机<br>
|
124
|
+
|
125
|
+
3000円
|
126
|
+
|
127
|
+
</h3>
|
128
|
+
|
129
|
+
<button class ="btn" onclick="document.getElementById('contents3').style.visibility = 'visible';">クリック</button>
|
130
|
+
|
131
|
+
<button class ="btn" onclick=cloneElement2()>追加</button>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="menu-card">
|
138
|
+
|
139
|
+
<div class="menu-card-inner">
|
140
|
+
|
141
|
+
<img class="menu-image" src="./images/471429001.jpg" alt="レモネード">
|
142
|
+
|
143
|
+
<h3 class="menu-title">食器棚<br>
|
144
|
+
|
145
|
+
8000円</h3>
|
146
|
+
|
147
|
+
<button class ="btn" onclick="document.getElementById('contents4').style.visibility = 'visible';">クリック</button>
|
148
|
+
|
149
|
+
<button class ="btn" onclick=cloneElement3()>追加</button>
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<div class="menu-card">
|
160
|
+
|
161
|
+
<div class="menu-card-inner">
|
162
|
+
|
163
|
+
<img class="menu-image" src="./images/mv_raffia-1.jpg" alt="カフェラテ">
|
164
|
+
|
165
|
+
<h3 class="menu-title">ベット<br>
|
166
|
+
|
167
|
+
16000円</h3>
|
168
|
+
|
169
|
+
<button class ="btn" onclick="document.getElementById('contents5').style.visibility = 'visible';">クリック</button>
|
170
|
+
|
171
|
+
<button class ="btn" onclick=cloneElement4()>追加</button>
|
172
|
+
|
173
|
+
</div>
|
174
|
+
|
175
|
+
</div>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
//追加しました
|
98
180
|
|
99
181
|
css
|
100
182
|
|
@@ -376,6 +458,202 @@
|
|
376
458
|
|
377
459
|
}
|
378
460
|
|
461
|
+
|
462
|
+
|
463
|
+
function cloneElement1(){
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
//追加しました
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
const tpl = document.getElementById(kagu[1]);
|
474
|
+
|
475
|
+
const clone1 = tpl.cloneNode(true);
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
// idとdisplayの設定
|
482
|
+
|
483
|
+
clone1.id = "clone1";
|
484
|
+
|
485
|
+
clone1.class = "sample";
|
486
|
+
|
487
|
+
clone1.style.left ="0px";
|
488
|
+
|
489
|
+
clone1.style.display ="block";
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
clone1.addEventListener("drag",moveItems)
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
// フローリングに表示
|
502
|
+
|
503
|
+
base = document.getElementById('box1')
|
504
|
+
|
505
|
+
base.appendChild(clone1);
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
}
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
function cloneElement2(){
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
const tpl = document.getElementById(kagu[2]);
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
const clone2 = tpl.cloneNode(true);
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
// idとdisplayの設定
|
530
|
+
|
531
|
+
clone2.id = "clone2";
|
532
|
+
|
533
|
+
clone2.class = "sample";
|
534
|
+
|
535
|
+
clone2.style.left ="0px";
|
536
|
+
|
537
|
+
clone2.style.display ="block";
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
clone2.addEventListener("drag",moveItems)
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
// フローリングに表示
|
548
|
+
|
549
|
+
base = document.getElementById('box1')
|
550
|
+
|
551
|
+
base.appendChild(clone2);
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
}
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
function cloneElement3(){
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
const tpl = document.getElementById(kagu[3]);
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
const clone3 = tpl.cloneNode(true);
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
// idとdisplayの設定
|
580
|
+
|
581
|
+
clone3.id = "clone3";
|
582
|
+
|
583
|
+
clone3.class = "sample";
|
584
|
+
|
585
|
+
clone3.style.left ="0px";
|
586
|
+
|
587
|
+
clone3.style.display ="block";
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
clone3.addEventListener("drag",moveItems)
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
// フローリングに表示
|
598
|
+
|
599
|
+
base = document.getElementById('box1')
|
600
|
+
|
601
|
+
base.appendChild(clone3);
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
}
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
function cloneElement4(){
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
const tpl = document.getElementById(kagu[4]);
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
const clone4 = tpl.cloneNode(true);
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
// idとdisplayの設定
|
626
|
+
|
627
|
+
clone4.id = "clone4";
|
628
|
+
|
629
|
+
clone4.class = "sample";
|
630
|
+
|
631
|
+
clone4.style.left ="0px";
|
632
|
+
|
633
|
+
clone4.style.display ="block";
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
clone4.addEventListener("drag",moveItems)
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
// フローリングに表示
|
644
|
+
|
645
|
+
base = document.getElementById('box1')
|
646
|
+
|
647
|
+
base.appendChild(clone4);
|
648
|
+
|
649
|
+
|
650
|
+
|
651
|
+
}
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
379
657
|
```
|
380
658
|
|
381
659
|
|
1
html css jsのライブラリ名を追加させてもらいました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,6 +64,180 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
+
HTML
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<div class="menu-card-inner">
|
72
|
+
|
73
|
+
<img class="menu-image" src="./images/0fb8a39d38f69ae68fa57ed1edf7b9ec.jpg" alt="家具1">
|
74
|
+
|
75
|
+
<h3 class="menu-title">本棚<br>
|
76
|
+
|
77
|
+
4800円</h3>
|
78
|
+
|
79
|
+
<button class ="btn" onclick="document.getElementById('contents1').style.visibility = 'visible';">クリック</button>
|
80
|
+
|
81
|
+
<button class ="btn" onclick=cloneElement()>追加</button>
|
82
|
+
|
83
|
+
//この追加機能を直したいです
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<button class ="btn" id="addbuton" onclick=remove()>削除</button>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
css
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
.box2{
|
106
|
+
|
107
|
+
background-color: rgb(206, 182, 106);
|
108
|
+
|
109
|
+
float:right;
|
110
|
+
|
111
|
+
width: 400px;
|
112
|
+
|
113
|
+
height:470px;
|
114
|
+
|
115
|
+
margin-right:250px ;
|
116
|
+
|
117
|
+
background-image:url(../images/depositphotos_22441037-stock-photo-room-interior-vintage-with-white.jpg);
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
.menu-card {
|
124
|
+
|
125
|
+
width: 33%;
|
126
|
+
|
127
|
+
margin-top: 50px;
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
.menu-card-inner {
|
132
|
+
|
133
|
+
padding: 10px 10px;
|
134
|
+
|
135
|
+
background-color: #084d85;
|
136
|
+
|
137
|
+
border-radius: 7px;
|
138
|
+
|
139
|
+
box-shadow: 1px 1px 4px #d2d4d6;
|
140
|
+
|
141
|
+
text-align: center;
|
142
|
+
|
143
|
+
margin: 0 20px;
|
144
|
+
|
145
|
+
width: 100px;
|
146
|
+
|
147
|
+
height: 110px;
|
148
|
+
|
149
|
+
margin-top: 10px;
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
.menu-image {
|
156
|
+
|
157
|
+
width: 50px;
|
158
|
+
|
159
|
+
height: 50px;
|
160
|
+
|
161
|
+
margin-bottom: 8px;
|
162
|
+
|
163
|
+
border-radius: 5px;
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
.menu-title {
|
168
|
+
|
169
|
+
margin-bottom: 8px;
|
170
|
+
|
171
|
+
font-size: 90%;
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
.menu-text {
|
176
|
+
|
177
|
+
font-size: 14px;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
.menu-card-wrapper {
|
182
|
+
|
183
|
+
display: flex;
|
184
|
+
|
185
|
+
flex-wrap: wrap;
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
h3{
|
190
|
+
|
191
|
+
color: white;
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
h2{
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
margin-top: px;
|
200
|
+
|
201
|
+
text-align: center;
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
.button1{
|
210
|
+
|
211
|
+
width: 50px;
|
212
|
+
|
213
|
+
height: 20px;
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
.menu-nedan {
|
218
|
+
|
219
|
+
margin-bottom: 8px;
|
220
|
+
|
221
|
+
font-size: 90%;
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
javascript
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
ライブラリは Yahoo! YUI Libraryを使用しています
|
238
|
+
|
239
|
+
|
240
|
+
|
67
241
|
YAHOO.util.Event.addLister(window,"load",moveItems)
|
68
242
|
|
69
243
|
//ライブりイベント
|