Mouseover, mouseout, mouseenter, mouseleave

q6hillz·2022년 4월 17일
0

javascript

목록 보기
35/60
post-custom-banner

mouseover와 mouseout의 필연적 관계

If mouseover triggered, there must be mouseout

In case of fast mouse movements, intermediate elements may be ignored, but one thing we know for sure: if the pointer “officially” entered an element (mouseover event generated), then upon leaving it we always get mouseout. !!!(descendants까지 Count하고 버블링되는 이벤트임.)

mouseover 이벤트가 trigger된다면 필연적으로 mouseout 이벤트 또한 trigger된다.

  • event.target – is the element where the mouse came over.
  • event.relatedTarget – is the element from which the mouse came (relatedTargettarget).

mouseenter와 mouseleave 설명

Events mouseenter/mouseleave are like mouseover/mouseout. They trigger when the mouse pointer enters/leaves the element.

But there are two important differences:

  1. Transitions inside the element, to/from descendants, are not counted.
  2. Events mouseenter/mouseleave do not bubble.

!!2가지 중요점이 있다.

  1. event가 일어난 element의 자손 요소를 Count하여 event가 일어나지 않는다.
  2. 버블링이 없다.
post-custom-banner

0개의 댓글