TA的每日心情 | 开心 2024-7-7 20:49 |
---|
签到天数: 476 天 [LV.9]铁杆吧粉
|
发表于 2018-9-2 21:05:44
|
显示全部楼层
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<style type="text/css">
.main{
border: 1px solid #000000;
width: 300px;
height: 100px;
margin: 0 auto;
}
.con_main{
width: 300px;
margin: 0 auto;
overflow: hidden;
margin-top: 10px;
padding-bottom: 10px;
border: 1px solid #088484;
}
.con_main ul li{
float: left;
width: 50px;
height: 80px;
margin: 10px 0 0 19px;
font-size: 14px;
border: 1px solid #f00;
}
</style>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
function show(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "block");
$(objDiv).css("left", event.clientX);
$(objDiv).css("top", event.clientY + 10);
}
function hide(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "none");
}
</script>
</head>
<body>
<div>
<div id="mydiv1" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容一
</div>
<div id="mydiv2" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容二
</div>
<a id="t1" onmouseover="javascript:show(this,'mydiv1');" onmouseout="hide(this,'mydiv1')">
鼠标悬停一</a>
<br>
<a id="t2" onmouseover="javascript:show(this,'mydiv2');" onmouseout="hide(this,'mydiv2')">
鼠标悬停二</a>
<div/>
</body>
</html><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<style type="text/css">
.main{
border: 1px solid #000000;
width: 300px;
height: 100px;
margin: 0 auto;
}
.con_main{
width: 300px;
margin: 0 auto;
overflow: hidden;
margin-top: 10px;
padding-bottom: 10px;
border: 1px solid #088484;
}
.con_main ul li{
float: left;
width: 50px;
height: 80px;
margin: 10px 0 0 19px;
font-size: 14px;
border: 1px solid #f00;
}
</style>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
function show(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "block");
$(objDiv).css("left", event.clientX);
$(objDiv).css("top", event.clientY + 10);
}
function hide(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "none");
}
</script>
</head>
<body>
<div>
<div id="mydiv1" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容一
</div>
<div id="mydiv2" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容二
</div>
<a id="t1" onmouseover="javascript:show(this,'mydiv1');" onmouseout="hide(this,'mydiv1')">
鼠标悬停一</a>
<br>
<a id="t2" onmouseover="javascript:show(this,'mydiv2');" onmouseout="hide(this,'mydiv2')">
鼠标悬停二</a>
<div/>
</body>
</html><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>测试</title>
<style type="text/css">
.main{
border: 1px solid #000000;
width: 300px;
height: 100px;
margin: 0 auto;
}
.con_main{
width: 300px;
margin: 0 auto;
overflow: hidden;
margin-top: 10px;
padding-bottom: 10px;
border: 1px solid #088484;
}
.con_main ul li{
float: left;
width: 50px;
height: 80px;
margin: 10px 0 0 19px;
font-size: 14px;
border: 1px solid #f00;
}
</style>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
function show(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "block");
$(objDiv).css("left", event.clientX);
$(objDiv).css("top", event.clientY + 10);
}
function hide(obj, id) {
var objDiv = $("#" + id + "");
$(objDiv).css("display", "none");
}
</script>
</head>
<body>
<div>
<div id="mydiv1" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容一
</div>
<div id="mydiv2" style="position: absolute; display: none; border: 1px solid silver;
background: silver;">
提示内容二
</div>
<a id="t1" onmouseover="javascript:show(this,'mydiv1');" onmouseout="hide(this,'mydiv1')">
鼠标悬停一</a>
<br>
<a id="t2" onmouseover="javascript:show(this,'mydiv2');" onmouseout="hide(this,'mydiv2')">
鼠标悬停二</a>
<div/>
</body>
</html> |
|