当您单击#video_background
或#nav
div#infowrap
淡入时。我想要但我发现几乎不可能保持与我现在完全相同的布局,#infowrap
但在右下角通过 div 打一个“洞”,这样你就可以看到#video_background
它洞。我已经考虑将 png 放在一个单独的 div 中,或者将 png 作为背景,但我无法让它工作。有任何想法吗?这是我的html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="description" content=""/>
<meta name="keywords"content=""/>
<title></title>
<link href="css/main.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<header>
<div id="nav">
<p><a id="btn" href="#">+</a></p>
</div>
</header>
<div id="container">
<div id="infowrap">
<div class="mainwrap">
<div class="smallwrap">
<p>Mustache art party pug whatever mixtape, pork belly sriracha gentrify swag. Try-hard selvage butcher high life, hashtag DIY ennui.</p>
</div>
<div class="smallwrap">
<p>Mustache art party pug whatever mixtape, pork belly sriracha gentrify swag. Try-hard selvage butcher high life, hashtag DIY ennui.</p>
</div>
<div class="smallwrap">
<p>Mustache art party pug whatever mixtape, pork belly sriracha gentrify swag. Try-hard selvage butcher high life, hashtag DIY ennui.</p>
</div>
<div class="smallwrap">
<p>Mustache art party pug whatever mixtape, pork belly sriracha gentrify swag. Try-hard selvage butcher high life, hashtag DIY ennui.</p>
</div>
</div>
</div>
</div>
<video id="video_background" src="vid/147000037.mp4" autoplay loop>
<script>
$('#video_background, #btn').on('click', function(){
$('#nav').toggleClass('rotate');
});
</script>
<script>
$(document).ready(function(){
$("#video_background, #nav").click(function(){
$("#infowrap").fadeToggle(250);
});
});
</script>
</body>
</html>
我的CSS:
* {
margin: 0;
padding: 0;
}
body {
width: 100%;
height: 100%;
margin: 0;
font-family: "HelveticaNeue-UltraLight","HelveticaNeue-Light","Helvetica Neue",Helvetica,Arial,sans-serif;
}
header {
z-index: 999;
display: block;
height: auto;
width: 100%;
position: fixed;
}
header a {
text-decoration: none;
font-size: 2.0em;
color: #000000;
}
#nav {
position: relative;
float: right;
top: 15px;
right: 25px;
color: #000000;
}
#video_background {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: -1000;
}
#container {
height: 100%;
width: 100%;
display: block;
}
#infowrap {
background: rgba(25,250,255,0.96);
z-index: 900;
display: none;
position: fixed;
top:10px;left:10px;right:10px;bottom:10px;
vertical-align: center;
}
.mainwrap {
width: 540px;
height: 540px;
margin: 50px auto 0 auto;
}
.smallwrap {
width: 250px;
height: 250px;
margin: 10px;
float: left;
position: relative;
}