-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdemo.html
298 lines (268 loc) · 9.94 KB
/
demo.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery Splatter</title>
<!-- stylesheets -->
<style type="text/css" media="screen">
body { overflow-x: hidden; color: #333; font-family: Helvetica, sans-serif; }
em { color: #95A105; font-style: normal; }
#page_wrap { width: 970px; margin: 0 auto; }
header #documentation { display: block; float: right;}
.example h3 { border-bottom: 2px solid #e0e0e0; margin: 100px 0 10px; padding-bottom: 5px; }
.example.first h3 { margin-top: 20px; }
.example .wrap { height: 400px; }
.example code pre { background: #e0e0e0; padding: 20px 20px 20px 0; overflow: auto; }
.example .wrap div { height: 250; width: 700 }
/* CSS3 for custom animations */
#animated_colors.splatter_box .splat {
transition: color 0.5s linear;
-moz-transition: color 0.5s linear;
-o-transition: color 0.5s linear;
-webkit-transition: color 0.5s linear;
cursor: pointer;
}
#rotating_splats.splatter_box .splat {
-webkit-transform-origin:0 0;
-webkit-transform: rotate(0deg);
-webkit-transition:-webkit-transform 0.2s ease-in-out;
cursor: pointer;
}
#no_overlap_splats {
position: static !important;
top: auto !important;
left: auto !important;
float: left;
}
</style>
<!-- javascripts -->
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript" charset="utf-8"></script> -->
<script src="lib/jquery.local.js" type="text/javascript"></script>
<script src="lib/jquery.masonary.js" type="text/javascript" charset="utf-8"></script>
<script src="src/jquery.splatter.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// 1) simple_splatter
$('#simple_splatter').splatter({
height: 250,
width: 700
});
// 2) many splatters
$('#many_splatters').splatter({
height: 250,
width: 700,
splat_count: 120
});
// 3) word_splatter
$('#word_splatter').splatter({
height: 250,
width: 700,
min_font_size: 20,
max_font_size: 50,
splats: ["Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetur", "Adipisicing", "Elit", "Sed", "Do", "Eiusmod", "Tempor", "Incididunt", "Ut", "Labore", "Et", "Dolore", "Magna", "Aliqua", "Ut", "Enim", "Ad", "Minim", "Veniam", "Quis", "Nostrud", "Exercitation", "Ullamco", "Laboris", "Nisi", "Ut", "Aliquip", "Ex", "Ea", "Commodo", "Consequat"]
});
// 4) Gray words
$('#gray_words').splatter({
height: 250,
width: 700,
min_font_size: 20,
max_font_size: 50,
colors: ['#ccc', '#e0e0e0', '#333', '#666', '#999'],
splats: ["Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetur", "Adipisicing", "Elit", "Sed", "Do", "Eiusmod", "Tempor", "Incididunt", "Ut", "Labore", "Et", "Dolore", "Magna", "Aliqua", "Ut", "Enim", "Ad", "Minim", "Veniam", "Quis", "Nostrud", "Exercitation", "Ullamco", "Laboris", "Nisi", "Ut", "Aliquip", "Ex", "Ea", "Commodo", "Consequat"]
});
// 5) animated colors
$('#animated_colors').splatter({
width: 700,
height: 250,
splat_count: 100,
colors: ['#ccc', '#e0e0e0', '#333', '#666', '#999'],
custom_attributes: [
{ name: "data-hover_color", values: ['#f68a00', '#069', '#a70', '#090', '#ff1493', '#0066CC', '#ff1493', '#F0E356'] }
],
hover_on: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color')
splat.css('color', hover_color).attr('data-hover_color', original_color);
},
hover_off: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color');
splat.css('color', hover_color).attr('data-hover_color', original_color);
}
});
// 6) rotating_splats
$('#rotating_splats').splatter({
height: 250,
width: 700,
splat_count: 300,
max_font_size: 150,
custom_attributes: [
{ name: "data-rotation_degrees", values: ['rotate(180deg)', 'rotate(90deg)', 'rotate(25deg)', 'rotate(360deg)' ] }
],
hover_on : function(splat) {
var rotation_degrees = splat.attr('data-rotation_degrees');
splat.css('-webkit-transform', rotation_degrees);
},
hover_off : function(splat) {
splat.css('-webkit-transform', 'rotate(0deg)');
}
});
// no_overlap_splats
$('#no_overlap_splats').splatter({
height: 250,
width: 800,
splat_count: 50
});
$('#no_overlap_splats').masonry();
});
</script>
</head>
<body>
<div id="page_wrap">
<header>
<a href="https://github.com/coryschires/splatter" id="documentation">Back to documentation</a>
<h1>jQuery <em>Splatter</em> Plugin</h1>
</header>
<div class="first example">
<h3>A very simple example.</h3>
<div class="wrap"><div id="simple_splatter"></div></div>
<code>
<pre>
$('#simple_splatter').splatter({
height: 250,
width: 700
});</pre>
</code>
</div>
<div class="example">
<h3>Let's say you want more splats.</h3>
<div class="wrap"><div id="many_splatters"></div></div>
<code>
<pre>
$('#many_splatters').splatter({
height: 250,
width: 700,
splat_count: 120
});</pre>
</code>
</div>
<div class="example">
<h3>And if you'd rather use words.</h3>
<div class="wrap"><div id="word_splatter"></div></div>
<code>
<pre>
$('#word_splatter').splatter({
height: 250,
width: 700,
min_font_size: 20,
max_font_size: 50,
splats: ["Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetur", "Adipisicing", "Elit", "Sed", "Do", "Eiusmod", "Tempor", "Incididunt", "Ut", "Labore", "Et", "Dolore", "Magna", "Aliqua", "Ut", "Enim", "Ad", "Minim", "Veniam", "Quis", "Nostrud", "Exercitation", "Ullamco", "Laboris", "Nisi", "Ut", "Aliquip", "Ex", "Ea", "Commodo", "Consequat"]
});</pre>
</code>
</div>
<div class="example">
<h3>Suppose you don't want random colors.</h3>
<div class="wrap"><div id="gray_words"></div></div>
<code>
<pre>
$('#gray_words').splatter({
height: 250,
width: 700,
min_font_size: 20,
max_font_size: 50,
colors: ['#ccc', '#e0e0e0', '#333', '#666', '#999'],
splats: ["Lorem", "Ipsum", "Dolor", "Sit", "Amet", "Consectetur", "Adipisicing", "Elit", "Sed", "Do", "Eiusmod", "Tempor", "Incididunt", "Ut", "Labore", "Et", "Dolore", "Magna", "Aliqua", "Ut", "Enim", "Ad", "Minim", "Veniam", "Quis", "Nostrud", "Exercitation", "Ullamco", "Laboris", "Nisi", "Ut", "Aliquip", "Ex", "Ea", "Commodo", "Consequat"]
});</pre>
</code>
</div>
<div class="example">
<h3>Splats that animate color on hover.</h3>
<div class="wrap"><div id="animated_colors"></div></div>
<code>
<pre>
// javascript
$('#animated_colors').splatter({
width: 700,
height: 250,
splat_count: 100,
colors: ['#ccc', '#e0e0e0', '#333', '#666', '#999'],
custom_attributes: [
{ name: "data-hover_color", values: ['#f68a00', '#069', '#a70', '#090', '#ff1493', '#0066CC', '#ff1493', '#F0E356'] }
],
hover_on: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color')
splat.css('color', hover_color).attr('data-hover_color', original_color);
},
hover_off: function(splat) {
var original_color = splat.css('color');
var hover_color = splat.attr('data-hover_color');
splat.css('color', hover_color).attr('data-hover_color', original_color);
}
});
// CSS3 for color animations
#animated_colors.splatter_box .splat {
transition: color 0.5s linear;
-moz-transition: color 0.5s linear;
-o-transition: color 0.5s linear;
-webkit-transition: color 0.5s linear;
cursor: pointer;
}</pre>
</code>
</div>
<div class="example">
<h3>Splats that rotate on hover.</h3>
<div class="wrap"><div id="rotating_splats"></div></div>
<code>
<pre>
$('#rotating_splats').splatter({
height: 250,
width: 700,
splat_count: 300,
max_font_size: 150,
custom_attributes: [
{ name: "data-rotation_degrees", values: ['rotate(180deg)', 'rotate(90deg)', 'rotate(25deg)', 'rotate(360deg)' ] }
],
hover_on : function(splat) {
var rotation_degrees = splat.attr('data-rotation_degrees');
splat.css('-webkit-transform', rotation_degrees);
},
hover_off : function(splat) {
splat.css('-webkit-transform', 'rotate(0deg)');
}
});
// css3 for rotation
#rotating_splats.splatter_box .splat {
-webkit-transform-origin:0 0;
-webkit-transform: rotate(0deg);
-webkit-transition:-webkit-transform 0.2s ease-in-out;
cursor: pointer;
}</pre>
</code>
</div>
<div class="example">
<h3>Splats that don't overlap (depends on <a href="http://masonry.desandro.com/" title="jQuery Masonry">jquery.masonry.js</a>).</h3>
<div class="wrap"><div id="no_overlap_splats"></div></div>
<div style="clear:both;"></div>
<code>
<pre>
$('#no_overlap_splats').splatter({
height: 250,
width: 800,
splat_count: 50
});
// you'll need to include the masonry plugin. Checkout the readme for details.
$('#no_overlap_splats').masonry();
// And override a bit of CSS
#no_overlap_splats {
position: static !important;
top: auto !important;
left: auto !important;
float: left;
}
</pre>
</code>
</div>
</div><!-- page_wrap -->
</body>
</html>