body部分:
<body>
<div class='parentDiv'></div>
<div class='parentDiv'></div>
<div class='parentDiv'></div>
</body>
Jquery代码部分:
<script >
$(function(){
$('.parentDiv').mouseover(function(){
$(this).append("<div class='appendDIv'>这是追加的DIV</div>");
}).mouseout(function(){
$('.appendDIv').remove();
});
});
</script>
<style>
.parentDiv{
width: 100px;
height: 100px;
background-color: yellow;
float: left;
margin-left: 10px;
cursor: pointer;
}
.appendDIv{
position: relative;
left: 30px;
top: 70px;
z-index: 3;
width: 100px;
height: 100px;
background-color: green;
}
</style>