回答編集履歴

1

調整

2021/07/14 04:44

投稿

yambejp
yambejp

スコア116726

test CHANGED
@@ -8,9 +8,19 @@
8
8
 
9
9
  ```javascript
10
10
 
11
+ <style>
12
+
13
+ #chk,#chk:not(:checked) ~ ul li{display:none}
14
+
15
+ </style>
16
+
11
17
  <script>
12
18
 
13
19
  window.addEventListener("resize",()=>{
20
+
21
+ g1.style.display="";
22
+
23
+ g2.style.display="none";
14
24
 
15
25
  chk.checked=false;
16
26
 
@@ -18,6 +28,64 @@
18
28
 
19
29
  </script>
20
30
 
31
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" height="48" width="48">
32
+
33
+ <rect width="48" height="48" id="r1" style="opacity:0" />
34
+
35
+ <g id="g1">
36
+
37
+ <line x1="10" y1="12" x2="38" y2="12" stroke="black"/>
38
+
39
+ <line x1="10" y1="24" x2="38" y2="24" stroke="black"/>
40
+
41
+ <line x1="10" y1="36" x2="38" y2="36" stroke="black"/>
42
+
43
+ </g>
44
+
45
+ <g id="g2" style="display:none">
46
+
47
+ <rect width="48" height="48" fill="none" />
48
+
49
+ <line x1="12.13" y1="12.63" x2="36.13" y2="36.13" stroke="black"/>
50
+
51
+ <line x1="12.38" y1="36.38" x2="35.88" y2="12.38" stroke="black"/>
52
+
53
+ </g>
54
+
55
+ <g>
56
+
57
+ </g>
58
+
59
+ <script>
60
+
61
+ r1.addEventListener('click',()=>{
62
+
63
+ const flg=g1.style.display=="none";
64
+
65
+ g1.style.display=flg?"":"none";
66
+
67
+ g2.style.display=flg?"none":"";
68
+
69
+ chk.checked=!flg;
70
+
71
+ });
72
+
73
+ </script>
74
+
75
+ </svg>
76
+
21
77
  <input type="checkbox" id="chk">
22
78
 
79
+ <ul>
80
+
81
+ <li>1</li>
82
+
83
+ <li>2</li>
84
+
85
+ <li>3</li>
86
+
87
+ <ul>
88
+
89
+
90
+
23
91
  ```