선생님, arrow 로 활용해서 스크립트 짜봤는데 왜 안될까요? ㅠㅠㅠ
257
hnsempty4208
投稿した質問数 5
0
var partOne = document.querySelectorAll(".one h2");
const h2_add = () => {
partOne.classList.add("on");
};
const h2_remove = () => {
partOne.classList.remove("on");
};
window.addEventListener("scroll", () => {
var scrollPos = window.scrollY;
console.log(scrollPos);
const one = document.querySelector(".one").offsetTop;
// .offset().top;
if (scrollPos >= one) {
h2_add();
} else {
h2_remove();
}
});
<section class="one">
<article class="one__inner">
<div class="one__inner-item">
<div class="desc">
<h2>Vision Description</h2>
</div>
<div class="photo">
<img src="img/1.jpg" alt="" />
</div>
<button type="button">더보기</button>
</div>
<div class="one__inner-item">
<div class="desc">
<h2>Vision Description</h2>
</div>
<div class="photo">
<img src="img/1.jpg" alt="" />
</div>
<button type="button">더보기</button>
</div>
</article>
</section>
es6
javascript
回答 0
2022년 기준 웹팩 설정하실 때
0
344
0
로또 구현
0
287
0
Cannot get 은 무엇이 문제인걸까요?
0
575
0
작업했습니다.
2
238
0
타입 관련 궁금한 점이 있습니다.
1
256
1
Set 사용 안 한 풀이법
0
230
1
로또
0
252
0
이거 링크 없는거 맞죠?
0
195
0
export default 해도
0
205
0
로또 번호 생성 풀이는 없나요??
2
212
0
예제 오류 입니다.
0
194
0
로또 번호 생성기 소스코드
0
339
0
강의에서 사용하시는 툴이 궁금해요
0
266
1
풀이가 없어서
1
250
0
this 바인딩 질문드립니다~
0
242
1
bundle.js 내용이 index.js와 동일합니다
0
737
4
로또 번호 생성기 풀이
0
268
0
전 html 파일을 만들어서 해결해봤습니다.
0
219
0
newArr에 map으로 묶은 fucntion 인자들은 어디서 받아오는 값인가요?
0
201
0
제 답변 올립니다.
0
234
1
ws.has(arr) 문의 입니다.
4
228
2
로또번호 생성기 풀이
0
158
0
왜 이건 유튜브로 나와요?
0
195
0
2020.04 최신 버전으로 진행시 참고하시면 될거같습니다.
13
616
2

