jQuery 의 mousemove() 메서드

❮ jQuery 이벤트 메소드

예시

페이지 내에서 마우스 포인터의 위치 가져오기:

$(document).mousemove(function(event){
  $("span").text(event.pageX + ", " + event.pageY);
});

정의 및 사용

mousemove 이벤트는 마우스 포인터가 선택한 요소 내에서 이동할 때마다 발생합니다.

mousemove() 메서드는 mousemove 이벤트를 트리거하거나 mousemove 이벤트가 발생할 때 실행할 함수를 첨부합니다.

참고: 사용자가 마우스를 한 픽셀 이동할 때마다 mousemove 이벤트가 발생합니다. 모든 mousemove 이벤트를 처리하려면 시스템 리소스가 필요합니다. 이 이벤트를 주의해서 사용하십시오.


통사론

선택한 요소에 대해 mousemove 이벤트를 트리거합니다.

$(selector).mousemove()

mousemove 이벤트에 함수를 연결합니다.

$(selector).mousemove(function)

Parameter Description
function Optional. Specifies the function to run when the mousemove event is triggered

직접 해보십시오 - 예


의 차이점 mouseover(), mouseenter() 및 mousemove()의 차이점을 보여줍니다.


❮ jQuery 이벤트 메소드