forked from alvarotrigo/fullPage.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrigger-animations.html
159 lines (144 loc) · 6.24 KB
/
trigger-animations.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Callbacks - fullPage.js</title>
<meta name="author" content="Alvaro Trigo Lopez" />
<meta name="description" content="fullPage callback function." />
<meta name="keywords" content="fullpage,jquery,demo,callbac,function,event" />
<meta name="Resource-type" content="Document" />
<link rel="stylesheet" type="text/css" href="../dist/fullpage.css" />
<link rel="stylesheet" type="text/css" href="examples.css" />
<!--[if IE]>
<script type="text/javascript">
var console = { log: function() {} };
</script>
<![endif]-->
<style>
#section2 img{
left: 130%;
position:relative;
transition: all 600ms ease;
}
#section2 p{
opacity: 0;
transition: all 600ms ease;
}
#section3 .intro{
left: -130%;
position:relative;
transition: all 600ms ease;
}
#section3 .intro{
left: -130%;
position:relative;
transition: all 600ms ease;
}
/**
* Here we fire the animation for section 3.
* As the fp-viewing class in the body changes on each section and slide.
*/
body.fp-viewing-3rdPage #section3 .intro{
left: 0%;
}
</style>
</head>
<body>
<select id="demosMenu">
<option selected>Choose Demo</option>
<option id="jquery-adapter">jQuery adapter</option>
<option id="active-slide">Active section and slide</option>
<option id="auto-height">Auto height</option>
<option id="autoplay-video-and-audio">Autoplay Video and Audio</option>
<option id="backgrounds">Background images</option>
<option id="backgrounds-fixed">Fixed fullscreen backgrounds</option>
<option id="background-video">Background video</option>
<option id="callbacks-v2-compatible">Callbacks version 2</option>
<option id="callbacks-v3">Callbacks version 3</option>
<option id="continuous-horizontal">Continuous horizontal</option>
<option id="continuous-vertical">Continuous vertical</option>
<option id="parallax">Parallax</option>
<option id="css3">CSS3</option>
<option id="drag-and-move">Drag And Move</option>
<option id="easing">Easing</option>
<option id="fading-effect">Fading Effect</option>
<option id="fixed-headers">Fixed headers</option>
<option id="gradient-backgrounds">Gradient backgrounds</option>
<option id="interlocked-slides">Interlocked Slides</option>
<option id="looping">Looping</option>
<option id="methods">Methods</option>
<option id="navigation-vertical">Vertical navigation dots</option>
<option id="navigation-horizontal">Horizontal navigation dots</option>
<option id="navigation-tooltips">Navigation tooltips</option>
<option id="no-anchor">No anchor links</option>
<option id="normal-scroll">Normal scrolling</option>
<option id="normalScrollElements">Normal scroll elements</option>
<option id="offset-sections">Offset sections</option>
<option id="one-section">One single section</option>
<option id="reset-sliders">Reset sliders</option>
<option id="responsive-auto-height">Responsive Auto Height</option>
<option id="responsive-height">Responsive Height</option>
<option id="responsive-width">Responsive Width</option>
<option id="responsive-slides">Responsive Slides</option>
<option id="scrollBar">Scroll bar enabled</option>
<option id="scroll-horizontally">Scroll horizontally</option>
<option id="scrollOverflow">Scroll inside sections and slides</option>
<option id="scrollOverflow-reset">ScrollOverflow Reset</option>
<option id="lazy-load">Lazy load</option>
<option id="scrolling-speed">Scrolling speed</option>
<option id="trigger-animations">Trigger animations</option>
<option id="vue-fullpage">Vue-fullpage component</option>
</select>
<ul id="menu">
<li data-menuanchor="firstPage"><a href="#firstPage">First slide</a></li>
<li data-menuanchor="secondPage"><a href="#secondPage">Second slide</a></li>
<li data-menuanchor="3rdPage"><a href="#3rdPage">Third slide</a></li>
</ul>
<div id="fullpage">
<div class="section " id="section1">
<div class="intro">
<h1>Animations</h1>
<p>You can make use of <a href="https://github.com/alvarotrigo/fullPage.js#callbacks" target="_blank">callbacks</a> or <a href="https://github.com/alvarotrigo/fullPage.js#state-classes-added-by-fullpagejs" target="_blank">state classes</a> to fire animations.</p>
<p>See my video tutorial regarding how to create css3 animations too!</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/qiCVPpI9l3M" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
</div>
<div class="section" id="section2">
<div class="intro">
<img src="imgs/1.png" alt="Cool" />
<h1>From the callbacks</h1>
<p>Animation fired through fullPage.js callbacks, making use of css3 transitions.</p>
</div>
</div>
<div class="section" id="section3">
<div class="intro">
<h1>Cool uh?</h1>
<p>Choose the best easing effect for your site!</p>
</div>
</div>
</div>
<script type="text/javascript" src="../dist/fullpage.js"></script>
<script type="text/javascript" src="examples.js"></script>
<script type="text/javascript">
var myFullpage = new fullpage('#fullpage', {
sectionsColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', 'whitesmoke', '#ccddff'],
anchors: ['firstPage', 'secondPage', '3rdPage', '4thpage', 'lastPage'],
menu: '#menu',
afterLoad: function(origin, destination, direction){
//section 2
if(destination.index == 1){
document.querySelector('#section2').querySelector('img').style.left = 0 + 'px';
document.querySelector('#section2').querySelector('p').style.opacity = 1;
}
//back to original state
else if(origin && origin.index == 1){
document.querySelector('#section2').querySelector('img').style.left = 130 + '%';
document.querySelector('#section2').querySelector('p').style.opacity = 0;
}
//section 3 is using the state classes to fire the animation
//see the CSS code above!
}
});
</script>
</body>
</html>