mouseenter、mouseout、mouseleave
时间: 2023-09-13 17:05:43 浏览: 133
mouseenter、mouseout、mouseleave都是在鼠标与元素之间交互时触发的事件,它们的区别如下:
- mouseenter:当鼠标进入元素时触发。它只会在鼠标从元素外部进入元素内部时触发一次,不会在元素内部移动时重复触发。
- mouseout:当鼠标离开元素时触发。它只会在鼠标从元素内部离开元素外部时触发一次,不会在元素外部移动时重复触发。
- mouseleave:当鼠标离开元素时触发。与mouseout类似,但有一个区别是它不会在鼠标进入元素内部时触发。
总结来说,mouseenter和mouseleave只在鼠标进入和离开元素时触发一次,而mouseout在鼠标离开元素时触发一次,并且在元素内部移动时也会重复触发。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [mouseenter、mouseleave、mouseover和mouseout的区别](https://blog.csdn.net/sinat_36521655/article/details/80237213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [关于事件mouseover ,mouseout ,mouseenter,mouseleave的区别](https://download.csdn.net/download/weixin_38700790/12802791)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文