当鼠标移动到元素上时就会触发mouseenter事件,类似mouseover。
他们两个之间的差别是:mouseover 鼠标经过自身盒子会触发,经过子盒子还会触发。mouseenter只会经过自身盒子触发,之所以这样,就是因为mouseenter不会冒泡。
所以在使用事件委托时,会使用mouseenter。
当鼠标移动到元素上时就会触发mouseenter事件,类似mouseover。
他们两个之间的差别是:mouseover 鼠标经过自身盒子会触发,经过子盒子还会触发。mouseenter只会经过自身盒子触发,之所以这样,就是因为mouseenter不会冒泡。
所以在使用事件委托时,会使用mouseenter。