Newbie_小白
没有都对的别人,也没有全错的自己,至少要有自己的坚持,无关他人、无关外物!
HTML:
<!DOCTYPE >

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
* {
margin: 0px;
padding: 0;
font-family: "微软雅黑", "arial", " sans-serif";
font-size: 16px;
}

body {
margin: 20px;
}
</style>
<script type="text/javascript" src="js/jquery-2.2.2.min.js">
</script>

<script type="text/javascript">
$(function () {
$("h2").hover(
function () {
$("#content").show(1);
},
function () {
$("#content").hide(1);
}
)
});
</script>
</head>

<body>
<div id="container">
<h2 style="margin: 0px;width: 166px;height: 25px;border: 1px silver solid;">关于hover方法的作用</h2>

<div id="content" style="width: 300px;height: 150px;border: 1px solid red;padding: 10px;display: none;">
hover方法:当鼠标移动到元素上或者是移出元素时执行事件处理代码,hover方法实际上是对mouseenter和mouseleave事件的合并,用来模仿一种鼠标悬停的效果
</div>
</div>

</body>

</html>

result:

运行:

posted on 2016-05-16 13:33  Newbie_小白  阅读(235)  评论(0编辑  收藏  举报