回答編集履歴

1

.

2023/05/24 07:25

投稿

int32_t
int32_t

スコア20909

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
  // ここでメイン画像を消す