标签:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<style type="text/css">
html,
body {
padding: 0;
margin: 0;
}
div {
position: absolute;
top: 0;
padding-top: 800px;
width: 100%;
}
.main {
height: 1000px;
background-image: -webkit-linear-gradient(top, #000, #fff);
}
.content {
display: none;
z-index: 1;
height: 1800px;
background-image: -webkit-linear-gradient(top, #CA7070, #3570BD);
}
.fixLabel {
position: absolute;
width:0px;
height:0px;
/*display: none;*/
}
</style>
</head>
<body>
<div class="main">
<a href="#id" id=‘btn1‘>进入</a>
</div>
<div class="content" id="id">
<a href="#fixLabel" id=‘btn2‘>返回</a>
</div>
<script type="text/javascript">
document.getElementById(‘btn1‘).addEventListener(‘click‘, function() {
var label = document.createElement(‘label‘);
label.className = ‘fixLabel‘;
label.id = ‘fixLabel‘;
label.style.top = document.body.scrollTop + ‘px‘;
document.body.appendChild(label);
document.querySelector(‘.content‘).style.display = ‘block‘;
}, false);
document.getElementById(‘btn2‘).addEventListener(‘click‘, function() {
document.querySelector(‘.content‘).style.display = ‘none‘;
}, false);
</script>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/djawh/p/4349866.html