二维码显示与隐藏
鼠标进入
鼠标离开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.small{
width: 50px;
height: 50px;
background: url(images/code.jpg) no-repeat;
background-size: 50px 50px;
position: fixed;
right: 10px;
top: 40%;
}
.first,.second{
width: 80px;
height: 80px;
position: absolute;
}
.first{
top: 0;
left: -30px;
}
.second{
top: 80px;
left: -30px;
}
.hide{
display: none;
}
.show{
display: block;
}
.small a{
display: block;
width: 50px;
height: 50px;
}
</style>
</head>
<body>
<div class="small" id="small">
<a href=""></a>
<div class="hide" id="big">
<img class="first" src="images/code1.jpg">
<img class="second" src="images/code2.jpg">
</div>
</div>
<script type="text/javascript">
var mask = document.getElementById("small").getElementsByTagName("a")[0];
mask.onmouseover = function () {
document.getElementById("big").className = "show";
};
mask.onmouseout = function () {
document.getElementById("big").className = "hide";
};
</script>
</body>
</html>