回答編集履歴
1
.
test
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
`classList.toggle()` でできるかと思います。
|
2
2
|
|
3
3
|
```js
|
4
|
-
if (this.classList.toggle('active')) {
|
4
|
+
if (this.closest('li').classList.toggle('active')) {
|
5
5
|
document.getElementById('select-img').src = ...;
|
6
6
|
} else {
|
7
7
|
// ここでメイン画像を消す
|