$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
$( selector ).hover( handlerIn, handlerOut )Example:
$( p” ).hover(
function() { // 鼠标进入
$( this ).addClass( hover” );
}, function() { // 鼠标退出 zone
$( this ).removeClass( hover” );
}
);
$(selector).hover(handlerInOut)将单个函数传递给 hover(),它将执行两个事件,mouseenter 和 mouseleave。这允许 jQuery 用户在处理程序中使用不同的故障转移方法,或者根据 event.type.
$( selector ).on( 鼠标指针进出框”, handlerInOut );
Please disable your ad blocker and refresh the window to use this website.