<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>鱼C工作室</title>
<style type="text/css">
body{
background: url("bg.jpg") no-repeat 50% 0;
font-family: "Adobe Fangsong Std";
color: #e02562;
}
#main,#slogan,#run{
position: relative;
height: 666px;
}
#main{
padding-top: 555px;
text-align: center;
}
#main{
opacity: 0;
transition: all 2.2s .3s;/*延长0.3s,动画总长2.2s*/
}
#main.show{
opacity: 1;
}
#main h1{
font-size: 93px;
font-family: "Adobe Caslon Pro";
}
#main h2{
font-size: 33px;
font-weight:100;
}
#slogan{
padding-top: 111px;
text-align: center;
}
#slogan h1{
display:inline-block;
padding-top: 12px;
padding-bottom: 12px;
border-top: 3px solid #000;
border-bottom: 3px dotted #000;
}
#slogan h2{
font-size: 33px;
}
#run h1{
position: absolute;
font-family: "Abadi MT Condensed Extra Bold";
font-size: 77px;
right: 41%;
top: 8%;
}
#run h2{
position: absolute;
font-size: 33px;
right: 41%;
top: 25%;
}
#run img{
position: absolute;
left: 40%;
top: 37%;
}
#slogan h1{
opacity: 0;
transform: scaleY(0);
transition: all 1.5s;
}
#slogan h2{
opacity: 0;
transform: scaleX(0);
transition: all 1.5s .5s;
}
#slogan h1.scroll{
opacity: 1;
transform: scaleY(1);
}
#slogan h2.scroll{
opacity: 1;
transform: scaleX(1);
}
#run h1{
opacity: 0;
transform: translateX(-200px);
transition: all 2s;
}
#run h2{
opacity: 0;
transform: translateX(200px);
transition: all 2s .5s;
}
#run img{
opacity: 0;
transform: translateX(200px);
transition: all 2.5s .5s;
}
#run h1.scroll,#run h2.scroll,#run img.scroll{
opacity: 1;
transform: translateX(0px);
}
</style>
</head>
<body>
<div id="main">
<h1>鱼C英雄帖</h1>
<h2>欢迎加入鱼C党卫军</h2>
</div>
<div id="slogan">
<h1>隐藏在黑暗中的正义</h1>
<h2>守护鱼C和平</h2>
</div>
<div id="run">
<h1>I need U</h1>
<h2>让编程改变世界</h2>
<img src="xiangyun.png">
</div>
<script type="text/javascript" src="jquery-2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var slogan2_y = $('#slogan').offset().top;
var buffer = 500;/*触发px*/
var slogan3_y = $('#run').offset().top;
var windowHeight = $(window).height();
$('#main').addClass('show');
$(window).scroll(function(){
pos = $(window).scrollTop();
if(pos > slogan2_y-buffer){
$('#slogan > h1').addClass('scroll');
$('#slogan > h2').addClass('scroll');
}
if(pos > slogan3_y-buffer){
$('#run > h1').addClass('scroll');
$('#run > h2').addClass('scroll');
$('#run > img').addClass('scroll');
}
if(pos < slogan2_y-windowHeight+buffer){
$('#slogan > h1').removeClass('scroll');
$('#slogan > h2').removeClass('scroll');
}
if(pos < slogan3_y-windowHeight+buffer){
$('#run > h1').removeClass('scroll');
$('#run > h2').removeClass('scroll');
$('#run > img').removeClass('scroll');
}
})
})
</script>
</body>
</html>
|