forked from ctrl-freaks/freezeframe.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
371 lines (317 loc) · 12.6 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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html>
<head>
<title>freezeframe.js v2.0.2 documentation</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<h1>freezeframe.js v2.0.2</h1>
<p>Documentation & Examples</p>
<h2>Navigation</h2>
<ol>
<li><p><a href="#examples">Examples</a></p></li>
<li><p><a href="#installation">Installation</a></p></li>
<li><p><a href="#styling-centering">Styling and Centering</a></p></li>
<li><p><a href="#infinite-scroll">Use with Infinite-Scroll</a></p></li>
<li><p><a href="#variables">Variables</a></p></li>
</ol>
<h2 id="examples">Examples</h2>
<ol>
<li><p><a href="example">Single Image</a></p></li>
<li><p><a href="example/infinite_scroll.html">Integrated with Infinite-Scroll</a></p></li>
</ol>
<h3>Image Credit</h3>
<p>Included GIF's Copyright © 2012 <a href="http://headlikeanorange.tumblr.com" target="_blank">http://headlikeanorange.tumblr.com</a></p>
<h2 id="installation">Installation</h2>
<ol>
<li><p>freezeframe.js requires the <a href="http://www.jquery.com" target="_blank">jQuery framework</a>. Include the latest version of jQuery in your page header <span class="bold">before</span> including freezeframe.js.<br /><a href="http://www.jquery.com" target="_blank">http://www.jquery.com</a></p></li>
</ol>
<h3>HTML Header</h3>
<pre><script type="text/javascript" src=<span class="color">"jquery.js"</span>></script></pre>
<span class="note"><span class="bold">Note:</span> I recommend using the latest version of jQuery from Google Hosted Libraries<br /><a href="https://developers.google.com/speed/libraries/devguide#jquery" target="_blank">https://developers.google.com/speed/libraries/devguide#jquery</a></span>
<ol start="2">
<li><p>Download the current version of freezeframe.js.</p></li>
<li><p>Upload freezeframe.js to your webserver.</p></li>
</ol>
<ul>
<li><p>Optionally, If you are interested in modifying freezeframe in a sandboxed environment, upload the <span class="bold">example/</span> directory to your webserver and modify the contents of <span class="bold">example/</span>.</p></li>
</ul>
<ol start="4">
<li><p>Include the following code in your <span class="bold">HTML Header</span>. This will include the script and set it to run on page load.</p></li>
</ol>
<h3>HTML Header</h3>
<pre><script type="text/javascript" src=<span class="color">"freezeframe.js"</span>></script></pre>
<ul>
<li><p>Optionally, you can customize variables that determine how freezeframe functions and looks in the HTML Header.</p></li>
</ul>
<h3>HTML Header (Optional)</h3>
<pre><script type="text/javascript" src=<span class="color">"freezeframe.js"</span>>
<span class="color">freezeframe_options = {
loading_background_color: "red",
animation_icon_position: "center center"
}</span>
</script></pre>
<ul>
<li><p>You can also include these custom variables anywhere on the page.</p></li>
</ul>
<h3>HTML Body (Optional)</h3>
<pre>...
</body>
</html>
<script type="text/javascript">
<span class="color">freezeframe_options = {
loading_background_color: "red",
animation_icon_position: "center center"
}</span>
</script></pre>
<ol start="5">
<li><p>Add the CSS class <span class="bold">freezeframe</span> to each image you want modified. You can change the class name that Freezeframe searches for via the <span class="bold">"class_name"</span> variable.</p></li>
</ol>
<h3>HTML</h3>
<pre><img class=<span class="color">"freezeframe"</span> src="whatever.gif" /></pre>
<h2 id="styling-centering">Styling and Centering the Image</h2>
<ul>
<li><p>To add CSS styling to the image, target the <span class="bold">figure</span> tag with the class <span class="bold">freezeframe-container</span> wrapped around the image and apply the styles to that element.</p></li>
</ul>
<h3>CSS</h3>
<pre><span class="color">figure.freezeframe-container</span> {
border-radius: 3px;
}</pre>
<ul>
<li><p>Because freezeframe.js forces the freezeframe-container figure element to be inline, if you want the image to be horizontally centered, apply <span class="bold">text-align: center;</span> to the image's parent element.</p></li>
</ul>
<h3>CSS</h3>
<pre>div#images-container {
<span class="color">text-align: center;</span>
}</pre>
<h2 id="infinite-scroll">Use with Infinite-Scroll</h2>
<ul>
<li><p>For use with <a href="Http://www.infinite-scroll.com" target="_blank">Infinite-Scroll</a>, follow the steps above and include <span class="bold">freezeframe.run()</span> as a new content callback function.<br /><a href="Http://www.infinite-scroll.com" target="_blank">http://www.infinite-scroll.com</a></p></li>
</ul>
<h3>JS</h3>
<pre>$('#content').infinitescroll({
option: "value",
option: "value",
...
},function(elements){
<span class="color">freezeframe.run();</span>
});</pre>
<!-- Variables -->
<h2 id="variables">Variables</h2>
<!-- class_name -->
<h3>class_name</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The class name that Freezeframe searches for to distinguish which images to process. This value is changed after the image is processed to avoid images being processed multiple times.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> [user defined value]
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p><span class="type">(string)</span> "freezeframe"</p>
</li>
</ul>
<pre><span class="color">class_name:</span> "my_class"</pre>
<!-- trigger_event -->
<h3>trigger_event</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The input event that will trigger the freezeframe elements to animate. This value is forced to "click" on touch devices if touch_device_support is set to true.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> "hover"<br />
<span class="type">(string)</span> "click"
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p><span class="type">(string)</span> "hover"</p>
</li>
</ul>
<pre><span class="color">trigger_event:</span> "click"</pre>
<!-- touch_device_support -->
<h3>touch_device_support</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>Determines freezeframe interaction on touch devices. If set to true, trigger_event on touch devices will be forced to "click", otherwise if set to false, trigger_event on touch devices will be set to the user input trigger_event value.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(boolean)</span> true<br />
<span class="type">(boolean)</span> false
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(boolean)</span> true
</p>
</li>
</ul>
<pre><span class="color">touch_device_support:</span> true</pre>
<!-- animation_play_duration -->
<h3>animation_play_duration</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The length of time in milliseconds that a GIF will animate if started by a "click" trigger_event. After this period of time the animation will stop.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(int)</span> [user defined value]
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(int)</span> 15000
</p>
</li>
</ul>
<pre><span class="color">animation_play_duration:</span> 1500</pre>
<!-- loading_background_color -->
<h3>loading_background_color</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The CSS color of the container shown in place of a GIF while it is processed.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> [user defined value]
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(string)</span> "#666"
</p>
</li>
</ul>
<pre><span class="color">loading_background_color:</span> "#666"</pre>
<!-- loading_background_image -->
<h3>loading_background_image</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>URL to the animated icon shown with the container shown in place of a GIF while it is being processed. Typically an animation to denote loading.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> [user defined image url]<br />
<span class="type">(boolean)</span> false
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(string)</span> [base 64 encoded icon]
</p>
</li>
</ul>
<pre><span class="color">loading_background_image:</span> "/images/loading_icon.gif"</pre>
<!-- loading_background_position -->
<h3>loading_background_position</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The CSS position of the animated icon with the container shown in place of a GIF while it is being processed.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> "top left"<br />
<span class="type">(string)</span> "top center"<br />
<span class="type">(string)</span> "top right"<br />
<span class="type">(string)</span> "center left"<br />
<span class="type">(string)</span> "center center"<br />
<span class="type">(string)</span> "center right"<br />
<span class="type">(string)</span> "bottom left"<br />
<span class="type">(string)</span> "bottom center"<br />
<span class="type">(string)</span> "bottom right"
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(string)</span> "top left"
</p>
</li>
</ul>
<pre><span class="color">loading_background_position:</span> "top left"</pre>
<!-- loading_fade_in_speed -->
<h3>loading_fade_in_speed</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The length of time in milliseconds it will take for the paused GIF to fade in over the loading placeholder.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(int)</span> [user defined value]
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(int)</span> 500
</p>
</li>
</ul>
<pre><span class="color">loading_fade_in_speed:</span> 500</pre>
<!-- animation_icon_image -->
<h3>animation_icon_image</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>URL for the icon layered above the paused GIF. The icon is used to repsent animation or the possiblity of animation (play arrow).</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> [user defined image url]<br />
<span class="type">(boolean)</span> false
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(string)</span> [base 64 encoded icon]
</p>
</li>
</ul>
<pre><span class="color">animation_icon_image:</span> "/images/animation_icon.gif"</pre>
<!-- animation_icon_position -->
<h3>animation_icon_position</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The CSS position of the icon layered above the paused GIF.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(string)</span> "top left"<br />
<span class="type">(string)</span> "top center"<br />
<span class="type">(string)</span> "top right"<br />
<span class="type">(string)</span> "center left"<br />
<span class="type">(string)</span> "center center"<br />
<span class="type">(string)</span> "center right"<br />
<span class="type">(string)</span> "bottom left"<br />
<span class="type">(string)</span> "bottom center"<br />
<span class="type">(string)</span> "bottom right"
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(string)</span> "top left"
</p>
</li>
</ul>
<pre><span class="color">animation_icon_position:</span> "top left"</pre>
<!-- animation_fade_out_speed -->
<h3>animation_fade_out_speed</h3>
<ul class="variable">
<li><span class="attribute">Description:</span><p>The length of time in milliseconds it will take for the animted GIF to fade back to the static first frame when the user is no longer triggering animation.</p></li>
<li>
<span class="attribute">Values:</span>
<p>
<span class="type">(int)</span> [user defined value]
</p>
</li>
<li>
<span class="attribute">Default:</span>
<p>
<span class="type">(int)</span> 300
</p>
</li>
</ul>
<pre><span class="color">animation_fade_out_speed:</span> 300</pre>
<p>Copyright © 2014 Chris Antonellis ⋅ <a href="http://www.chrisantonellis.com" target="_blank">http://www.chrisantonellis.com</a></p>
</body>
</html>