移入移出事件合并到一起

$(".father").mouseenter(function () {
alert("你好啊儿子");
});
$(".father").mouseleave(function () {
alert("儿子,爸爸走了");
});

合并到一起:

$(".father").hover(function () {
alert("你好啊儿子");
},function () {
alert("儿子,爸爸走了");
});

猜你喜欢

转载自www.cnblogs.com/duokexiao/p/11294889.html