html源代碼
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8" />
<title>Apple Watch 宣傳頁</title>
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.min.css" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="fullPage">
<div class="section section1">
<h1>它,終於來了。</h1>
<p>
爲了充分發揮體積小巧以及佩戴於手腕的優勢,Apple Watch帶來全新的科技和互動方式。它可以讓你更快速便捷地完成一些在早已習慣的事,也可以實現過去根本無法企及的新功能,因此,這將會是煥然一新的使用體驗,也將實現與你前所未有的貼近。
</p>
<a href="#">進一步瞭解</a>
</div>
<div class="section section2">
<h1>真正與你貼近的個人設備</h1>
<a href="#">進一步瞭解</a>
</div>
<div class="section section3">
<h1>非同一般的精準計時</h1>
<p>高級手錶想來以計時精準爲本,Apple Watch 更是如此。它與你的iPhone 配合使用,同全球標準時間的誤差不超過50毫秒。而且,你可以對錶盤進行個性化在設定,以更具個性化和意義的方式顯示時間,使其更貼合你的生活和日程需要。</p>
<a href="#">進一步瞭解計時</a>
</div>
<div class="section section4">
<h1>在三個特點鮮明的系列中找到你的風格</h1>
<div class="row">
<div class="column">
<img src="img/primary_large_2x.jpg" class="primary">
<h4 class="primary"></h4>
<div class="intro">
<p>不鏽鋼或深空黑色不鏽鋼錶殼,藍寶石水晶鏡面,搭配多款時尚錶帶。</p>
<a href="#" class="more">瞭解更多</a>
</div>
</div>
<div class="column">
<img src="img/sport_large_2x.jpg" class="sport">
<h4 class="sport"></h4>
<div class="intro">
<p>銀色或深空灰色的陽極氧化鋁金屬錶殼,強化Ion-X玻璃,搭配靚麗柔韌的錶帶。</p>
<a href="#" class="more">瞭解更多</a>
</div>
</div>
<div class="column">
<img src="img/edition_large_2x.jpg" class="edition">
<h4 class="edition"></h4>
<div class="intro">
<p>18K黃金或玫瑰金錶殼,藍寶石水晶鏡面,搭配精雕細琢的錶帶及表扣。</p>
<a href="#" class="more">瞭解更多</a>
</div>
</div>
</div>
</div>
</div>
<script src="jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.8.8/jquery.fullPage.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/move.js/0.5.0/move.min.js"></script>
<script src="app.js"></script>
</body>
</html>
css源代碼
*{
margin: 0;
padding: 0;
}
body{
font: 16px/1.8 "microsoft yahei",verdana;
}
.section{
position: relative;
background-color: #fff;
overflow: hidden;
text-align: center;
}
.section1{
background: url("img/hero_sunset_large_2x.jpg") no-repeat center;
background-size: cover;
}
.section1 h1{
margin-top: 5%;
color: #fff;
font-weight: normal;
font-size: 70px;
opacity: 0.8;
}
.section1 p{
margin: 5% auto 0;
color: #fff;
font-size: 18px;
width: 70%;
opacity: 0.6;
margin-top: 800px;
}
.section1 a{
display: block;
margin: 5% auto 0;
color: #ff9000;
font-size: 18px;
opacity: 0.9;
}
.section2{
background: #f2f2f2 url("img/technology_hero_large_2x.jpg") no-repeat bottom;
background-size: 100%;
}
.section2 h1{
margin: 20px auto;
color: #333;
font-weight: normal;
font-size: 60px;
}
.section2 a{
display: block;
margin: 20px auto 0;
color: #08c;
font-size: 18px;
}
.section3{
background: #fff url("img/timekeeping_hero_large_2x.jpg") no-repeat center 300px;
background-size: 50%;
}
.section3 h1{
margin: 20px auto;
color: #333;
font-weight: normal;
font-size: 40px;
width: 60%;
margin-left: -1500px;
}
.section3 p{
margin: 20px auto 0;
color: #333;
font-size: 18px;
width: 70%;
margin-left: 1500px;
}
.section3 a{
display: block;
margin: 20px auto 0;
color: #08c;
font-size: 18px;
}
.section4{
background: #fff;
}
.section4 h1{
margin: 20px auto;
color: #333;
font-weight: normal;
font-size: 30px;
}
.section4 .row{
width: 95%;
margin-left: 20px;
color: #333;
font-size: 18px;
}
.section4 .column{
float: left;
display: inline-block;
width: 31%;
margin: 10px;
padding-bottom: 30px;
background-color: #f2f2f2;
}
.section4 .column img{
height: 300px;
margin-top: 30px;
}
.section4 .column h4{
margin: 20px auto;
}
.section4 .column h4.primary{
background-image: url("img/logo_collection_primary.svg");
background-size: 102px 22px;
height: 22px;
width: 102px;
}
.section4 .column h4.sport{
background-image: url("img/logo_collection_sport.svg");
background-size: 178px 22px;
height: 22px;
width: 178px;
}
.section4 .column h4.edition{
background-image: url("img/logo_collection_edition.svg");
background-size: 190px 22px;
height: 22px;
width: 190px;
}
.section4 .column p{
margin: 10px auto;
width: 90%;
font-size: 16px;
}
.section4 .column a{
display: block;
margin: 10px auto 0;
color: #08c;
font-size: 16px;
}
js源代碼
// set()方法用於設置元素的css屬性,兩個參數css屬性和屬性值
// scale()方法用於放大或縮小元素
// rotate(deg)方法用於旋轉元素
// end()方法用於Move.js代碼片段的結束,標誌動畫的結束,該方法觸發動畫的播放
$(function(){
$("#fullPage").fullpage({
verticalCentered:false,
anchors:['page1','page2','page3','page4'],
continuousVertical:true,
navigation:true,
navigationTooltips:['它,終於來了。','真正與你貼近的個人設備','非同一般的精準計時','在三個特點鮮明的系列中找到你的風格'],
afterLoad:function(link,index){
switch(index){
case 1:
move(".section1 h1").scale(1.4).end();
move(".section1 p").set("margin-top","5%").end();
break;
case 2:
move(".section2 h1").scale(0.7).end();
break;
case 3:
move(".section3 h1").set("margin-left","20%").end();
move(".section3 p").set("margin-left","20%").end();
break;
case 4:
move(".section4 h1").scale(1.2).end();
move(".section4 img.primary").rotate(360).end(function(){
move(".section4 img.sport").rotate(360).end(function(){
move(".section4 img.edition").rotate(360).end(function(){
move(".section4 h4.primary").scale(1.3).end(function(){
move(".section4 h4.sport").scale(1.3).end(function(){
move(".section4 h4.edition").scale(1.3).end();
});
});
});
});
});
break;
default:
break;
}
},
onLeave:function(link,index){
switch(index){
case 1:
move(".section1 h1").scale(1).end();
move(".section1 p").set("margin-top","800px").end();
break;
case 2:
move(".section2 h1").scale(1).end();
break;
case 3:
move(".section3 h1").set("margin-left","-1500px").end();
move(".section3 p").set("margin-left","1500px").end();
break;
case 4:
move(".section4 h1").scale(1).end();
move(".section4 img.primary").rotate(-360).end();
move(".section4 img.sport").rotate(-360).end();
move(".section4 img.edition").rotate(-360).end();
move(".section4 h4.primary").scale(1).end();
move(".section4 h4.sport").scale(1).end();
move(".section4 h4.edition").scale(1).end();
break;
default:
break;
}
},
afterRender:function(){
},
});
});