터치 이벤트


* 터치 이벤트 예:

터치 시험 영역:

- 터치가 가능한 디바이스에서 확인해 주세요.

                                
                                    
                                
                            
                                
                                    const targetBox= document.querySelector('.touch_box_test') // 터치 이벤트 확인용 box
                                    const log= document.querySelector('.log-view') // 로그 출력 영역

                                    targetBox.addEventListener('touchstart', () => { log.textContent= '터치 시작' })
                                    targetBox.addEventListener('touchmove', () => { // 터치 위치 변경시 로그 표시
                                        const touch= event.changedTouches
                                        log.innerHTML= `${touch[0].pageX.toFixed(2)}, ${touch[0].pageY.toFixed(2)}`;
                                    });

                                    targetBox.addEventListener('touchend', () => { log.textContent= '터치 종료' })