forked from johnpolacek/scrollorama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
166 lines (148 loc) · 7.58 KB
/
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
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
160
161
162
163
164
165
166
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>scrollorama</title>
<link href='http://fonts.googleapis.com/css?family=Bowlby+One+SC' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/normalize.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jquery.lettering-0.6.1.min.js"></script>
<script src="js/jquery.scrollorama.js"></script>
</head>
<body>
<a href="https://github.com/johnpolacek/scrollorama">
<img style="position: fixed; top: 0; right: 0; border: 0; z-index: 11;" src="https://a248.e.akamai.net/assets.github.com/img/71eeaab9d563c2b3c590319b398dd35683265e85/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67" alt="Fork me on GitHub" alt="Fork me on GitHub" />
</a>
<p id="console"></p>
<div class="scrollblock" id="intro">
<h1 id="title">scrollorama</h1>
<p id="author">
created by <a href="http://twitter.com/johnpolacek">John Polacek</a>
<a href="https://twitter.com/johnpolacek" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @johnpolacek</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</p>
<p id="desc">The jQuery plugin for doing cool scrolly stuff</p>
<p id="download">
<span class="accent">★</span> DOWNLOAD <span class="accent">★</span><br />
<a class="download" href="https://github.com/johnpolacek/scrollorama/zipball/master">zip</a>
<a class="download" href="https://github.com/johnpolacek/scrollorama/tarball/master">tar</a>
</p>
</div>
<div class="scrollblock" id="examples-transition">
<h2>Transitions</h2>
<h3 id="fade-in">Fade In</h3>
<h3 id="fly-in">Fly In</h3>
<h3 id="rotate-in">Rotate In</h3>
<h3 id="zoom-in">Zoom In</h3>
<p id="any"><small><span class="accent">★</span> Any numeric CSS property <span class="accent">★</span></small></p>
</div>
<div class="scrollblock" id="examples-pin">
<h2>Pin It</h2>
<h3 id="unpin">★ Then unpin it ★</h3>
</div>
<div class="scrollblock" id="examples-parallax">
<h2 id="parallax1">Parallax</h2>
<h3 id="parallax2">Parallax</h3>
<h3 id="parallax3">Parallax</h3>
</div>
<div class="scrollblock" id="howtouse">
<h1>How To Use</h1>
<p id="disclaimer">Disclaimer: This is an experimental, just-for-fun sort of project and hasn’t been thoroughly tested.</p>
<div id="instructions">
<p>Design and build your site, dividing your content into blocks.</p>
<p class="divider">★ ★ ★</p>
<p>Embed scrollorama.js after jQuery and initialize the plugin, passing the blocks class selector as a parameter.</p>
<p><blockquote><pre>
$(document).ready(function() {
var scrollorama = $.scrollorama({
blocks:'.scrollblock'
});
});</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>Target an element and animate its properties.</p>
<p><blockquote><pre>
scrollorama.animate('#example1',{
duration:400, property:'opacity'
})</pre></blockquote></p>
<p id="instructions-animation">The animation parameters you can use are:</p>
<ul class="param-list">
<li>
<span class="param">duration</span>
<span class="param-def">number of pixels of scrolling the animation lasts</span>
</li>
<li>
<span class="param">delay</span>
<span class="param-def">number of pixels of scrolling before the animation starts<small>(animation is set to begin when the top of the scroll block is at the bottom of browser window)</small></span>
</li>
<li>
<span class="param">property</span>
<span class="param-def">css property being animated <small>(must be numeric)</small></span>
</li>
<li>
<span class="param">start</span>
<span class="param-def">value of the css property at the start of the animation <small>(if unassigned, will be the element’s current property value)</small></span>
</li>
<li>
<span class="param">end</span>
<span class="param-def">value of the css property at the end of the animation <small>(if unassigned, will be the element’s current property value)</small></span>
</li>
<li>
<span class="param">pin</span>
<span class="param-def">set to true if you want the scroll block to be pinned during its animations <small>(note: block will be pinned for all its element’s animations)</small></span>
</li>
</ul>
<p class="divider">★ ★ ★</p>
<p>Hook into the <code>onBlockChange</code> event.</p>
<p><blockquote><pre>
scrollorama.onBlockChange(function() {
alert('You just scrolled to block#'+scrollorama.blockIndex);
});</pre></blockquote></p>
</div>
</div>
<div class="scrollblock" id="credits">
<h1>Credits</h1>
<p>scrollorama by <a href="http://twitter.com/johnpolacek">John Polacek</a></p>
<p><a href="http://letteringjs.com">Lettering.js</a> by <a href="http://daverupert.com">Dave Rupert</a></p>
<p><a href="http://www.google.com/webfonts/specimen/Bowlby+One+SC">Bowlby One SC Font</a> by <a href="https://plus.google.com/107807505287232434305/about">Vernon Adams</a></p>
<p class="divider">★ ★ ★</p>
<p><small>If you like scrollorama, give <a href="http://johnpolacek.github.com/scrolldeck.js">scrolldeck</a> a try</small></p>
</div>
<script>
$(document).ready(function() {
// initialize the plugin, pass in the class selector for the sections of content (blocks)
var scrollorama = $.scrollorama({ blocks:'.scrollblock' });
// assign function to add behavior for onBlockChange event
scrollorama.onBlockChange(function() {
var i = scrollorama.blockIndex;
$('#console')
.css('display','block')
.text('onBlockChange | blockIndex:'+i+' | current block: '+scrollorama.settings.blocks.eq(i).attr('id'));
});
// lettering.js for coolness
$('#title').lettering();
$('#title span')
.css('display','block')
.css('float','left');
$('.char9').css('padding-left','6px');
// animate the title letters to explode
scrollorama.animate('#title',{ duration: 300, property:'zoom', end: 8 });
$('#title span').each(function() {
scrollorama.animate($(this),{ duration: 400, property:'top', end: Math.random()*120-180 });
scrollorama.animate($(this),{ duration: 300, property:'rotate', start:0, end:Math.random()*720-360 });
});
// animate some examples
scrollorama.animate('#unpin',{ duration:500, property:'padding-top', start:400, pin:true });
scrollorama.animate('#fade-in',{ delay: 400, duration: 300, property:'opacity', start:0 });
scrollorama.animate('#fly-in',{ delay: 400, duration: 300, property:'left', start:-1400, end:0 });
scrollorama.animate('#rotate-in',{ duration: 800, property:'rotate', start:720 });
scrollorama.animate('#zoom-in',{ delay: 200, duration: 600, property:'zoom', start:8 });
scrollorama.animate('#any',{ delay: 700, duration: 200, property:'opacity', start:0 });
scrollorama.animate('#any',{ delay: 800, duration: 200, property:'letter-spacing', start:18 });
// animate the parallaxing
scrollorama.animate('#parallax2',{ delay: 400, duration: 600, property:'top', start:800, end:-800 });
scrollorama.animate('#parallax3',{ delay: 200, duration: 1200, property:'top', start:500, end:-500 });
});
</script>
</body></html>