Home team project-bankapp-4
Post
Cancel

team project-bankapp-4

수평 스크롤

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  const horizontals = document.querySelectorAll('.saving')

  horizontals.forEach( horizontal => {
  horizontal.addEventListener('wheel', e => {
    e.preventDefault();
    if(e.wheelDelta > 0){
      // scroll up -> move left
      horizontal.scrollLeft -= 20;
    }else{
      // scroll down -> move right
      horizontal.scrollLeft += 20;
		}
    })
  })

메모

MDN 문서를 참고하여 구현한 코드
MDN에 역시 참고할 사항이 많은 것 같다

This post is licensed under CC BY 4.0 by the author.