完整代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ES6放大镜</title>
</head>
<style>
*{
margin: 0;
padding: 0;
}
.clear::after{
content: "";
clear: both;
display: block;
}
.main{
width: 800px;
height: 800px;
margin: 20px auto;
}
.box{
width: 300px;
height: 300px;
position: relative;
cursor: move;
border: 1px solid #ccc;
}
.box h2{
width: 100%;
height: 100%;
display: none;
}
.box h2 img{
width: 100%;
height: 100%;
}
.box .mask{
width: 120px;
height: 120px;
background-color: #fede4f;
opacity: 0.5;
display: none;
position: absolute;
left: 0;
top: 0;
}
.box .bigbox{
width: 300px;
height: 300px;
border: 1px solid #ccc;
overflow: hidden;
position: absolute;
left: 400px;
top: 0px;
display: none;
}
.box .bigbox img{
position: absolute;