fullpage.js 使用

fullpage-js

Posted by cl9000 on April 01, 2017

fullpage.js

链接

在使用

使用 - 具体参考官方文档

index.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>fullpage-js</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="style.css">
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" href="fullpage.css" />

</head>

<body style="background: #fc6c7c;text-align: center;">

<!-- fullpage -->
<div id="fullpage">
<!-- active 设置默认起始页 -->
<div class="section">Some section</div>
<div class="section active">Some section</div>
<div class="section">
<div class="slide" data-anchor="slide1"> slide 1 </div>
<div class="slide" data-anchor="slide2"> slide 2 <img data-src="static/bg.jpg" style="width: 80%;"></div>
<div class="slide" data-anchor="slide3"> slide 3
<!-- <audio controls data-autoplay data-keepplaying>
<source src="http://metakoncept.hr/horse.ogg" type="audio/ogg">
</audio>
<video controls> -->
<!-- <source data-src="video.webm" type="video/webm" /> -->
<!-- <source data-src="static/20190324.mp4" type="video/mp4" />
</video> -->
</div>
<div class="slide" data-anchor="slide4"> slide 4 </div>
</div>
<div class="section">整个视图</div>
<div class="section fp-auto-height"><h2>fp-auto-height 自动高度</h2></div>
<div class="section fp-auto-height-responsive">fp-auto-height-responsive 全屏,直到响应模式终止。 根据定义调整大小,可能是大于或小于视口</div>
</div>

<!-- 以下行是可选的。 只有在使用选项 css3:false ,并且您希望使用其他缓动效果,而非 linear、swing 或 easeInOutCubic 时才有必要。 -->
<!-- <script src="vendors/easings.min.js"></script> -->
<!-- 以下行仅在使用选项 scrollOverflow:true 的情况下是必需的 -->
<!-- <script type="text/javascript" src="vendors/scrolloverflow.min.js"></script> -->
<script type="text/javascript" src="fullpage.js"></script>
<!-- fullpage.js 初始化 -->
<script type="text/javascript">
var myFullpage = new fullpage('#fullpage', {
anchors:['firstPage', 'secondPage', 'thirdPage','fourthPage', 'fifthPage'],
sectionsColor: ['#fc6c7c', '#4BBFC3', '#7BAABE', '#898989', 'green']
});
</script>




<!-- 代码块 -->
<div class="shell">
<div class="shell-header">
<span class="shell-header-actions shell-header-close"></span>
<span class="shell-header-actions shell-header-minimize"></span>
<span class="shell-header-actions shell-header-maximize"></span>
<span class="shell-tabs">
<a href="#html" class="shell-tab active">HTML</a>
<a href="#js" class="shell-tab">JS</a>
</span>
<a href="https://codepen.io/alvarotrigo/pen/qqabrp" class="shell-demo">See in Codepen</a>
</div>
<div class="shell-body">
<div class="shell-tab-content active" data-tab="html">
<figure class="highlight">
<pre>
truetruetrue<code class="language-html" data-lang="html">222</code>
truetrue </pre>
</figure>
</div>

<div class="shell-tab-content" data-tab="js">
<figure class="highlight">
<pre>
truetruetrue<code class="language-javascript" data-lang="javascript">
truetruetruetrue<span style="color: #e5e4e4;">111</span>
truetruetrue</code>
truetrue </pre>
</figure>
</div>
</div>
</div>
</body>


<!-- 代码块 -->
<script>
// Jquery获取第一个子元素
// ($(".shell-tabs").children(":first")).on('click', function () {
// alert(222)
// });
// Jquery获取第几个子元素
$(".shell-tabs a").click(function () {
var index = $(".shell-tabs a").index(this);
if(0 == index) {
$(".shell-tabs").children('a').eq(0).addClass("active");
$(".shell-tabs").children('a').eq(1).removeClass("active");
$(".shell-body").children("div").eq(0).addClass("active");
$(".shell-body").children("div").eq(1).removeClass("active");
} else {
$(".shell-tabs").children('a').eq(0).removeClass("active");
$(".shell-tabs").children('a').eq(1).addClass("active");
$(".shell-body").children("div").eq(0).removeClass("active");
$(".shell-body").children("div").eq(1).addClass("active");
}
});
</script>

</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@charset "UTF-8";

/* 代码块 */
.shell {
width: calc(50% - 54px);
display: inline-block;
background-color: #173549;
border-radius: 5px 5px 0 0;
text-align: left;
margin-right: 54px;
}

@media screen and (max-width: 1030px) {
.shell {
width: calc(60% - 54px);
}
}

@media screen and (max-width: 900px) {
.shell {
width: 80%;
margin: 0;
}
}

.shell-header {
background: #e5e4e4;
padding: 0 7px;
position: relative;
}

.shell-header-actions {
border-radius: 50%;
height: 10px;
width: 10px;
margin: 0 2px;
/* box-shadow: 0px 0px 10px 1px; */
display: inline-block;
}

.shell-demo {
position: absolute;
right: 15px;
top: 13px;
color: #173549;
}

.shell-demo:hover {
text-decoration: underline;
float: right;
}

.shell-header-close {
background: red;
}

.shell-header-minimize {
background: yellow;
}

.shell-header-maximize {
background: green;
}

.shell-tab {
padding: 5px 10px;
display: inline-block;
padding: 14px 10px;
}

.shell-tab {
color: #173549;
}

.shell-tab.active {
background: #fff;
margin: 0;
}

.shell-tab:hover {
color: #000;
}

.shell-tab-content {
display: none;
}

.shell-tab-content.active {
display: block;
}

.shell-body {
margin: 2.18em;
font-size: 1.4em;
overflow-x: scroll;
}
/* 代码块 */


支付宝打赏 微信打赏

赞赏一下 坚持原创技术分享,您的支持将鼓励我继续创作!