테스트 환경 : 크롬 54.0.2840.99 m
작동방식 : 마우스가 이동할때뿐만 아니라 일정 시간 간격마다 반복하여 이벤트가 발생함
버블링 :
<div id="father">
<div id="child"></div>
</div>
위와 같이 부모와 자식 모두 동시에 발생함 순서는 child 객체의 mousemove 이벤트가 발생 한후 바로 father 객체의 mousemove 이벤트 발생
$("#father").mousemove(function(e){
$("#msg").text($("#msg").text() + ", " + e.currentTarget.id);
})
$("#father").mousemove(function(e){
$("#msg").text($("#msg").text() + ", " + e.currentTarget.id);
})
이벤트가 발생한 현재객체 접근은 e.currentTarget 이며
위 두경의 모두 e.target은 child 객체를 가르킴( << 정확한 원인분석필요)
'개발 > jQuery' 카테고리의 다른 글
jquery object를 html dom object로 변환하기 (0) | 2016.12.14 |
---|