jQuery鼠标事件之hover
上一节
下一节
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>16.5jQuery鼠标事件之hover</title>
<script src="../js/jquery-3.1.1.min.js"></script>
<script>
$(function(){
//hover():用于模拟鼠标悬停事件
//当鼠标移动到元素上时,会触发第一个函数(mouseenter);
//当鼠标移出这个元素时,会触发第二个函数(mouseleave)。
//hover(mouseenter,mouseleave)
$('#p1').hover(function(){$(this).css('color','red')},
function(){$(this).css('color','blue')});
});
</script>
</head>
<body>
<p id="p1">实现鼠标移入移出效果切换</p>
</body>
</html>
效果图


