teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

修正

2021/05/07 14:09

投稿

Jon_do
Jon_do

スコア1373

answer CHANGED
@@ -98,6 +98,7 @@
98
98
  <script>
99
99
  const box = document.getElementsByClassName("box");
100
100
  let timer = null;
101
+ const boxLen = box.length;
101
102
 
102
103
  window.addEventListener("wheel",(e)=>{
103
104
  clearTimeout(timer);
@@ -108,7 +109,6 @@
108
109
  });
109
110
 
110
111
  const changeBoxUp = () => {
111
- const boxLen = box.length;
112
112
  for(let i = 0; i < boxLen; i++){
113
113
  if(i == boxLen - 1) {
114
114
  box[i].classList.remove("show");
@@ -122,7 +122,7 @@
122
122
  }
123
123
 
124
124
  const changeBoxDown = () => {
125
- const boxLen = box.length;
125
+
126
126
  for(let i = 0; i < boxLen; i++){
127
127
  if(i == 0 && box[i].classList.contains("show")) {
128
128
  box[0].classList.remove("show");