forked from eikes/jquery.fullscreen.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslideshow-example.html
More file actions
282 lines (246 loc) · 11 KB
/
Copy pathslideshow-example.html
File metadata and controls
282 lines (246 loc) · 11 KB
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
<html>
<head>
<title>jQuery HTML5 Fullscreen Slideshow / Gallery</title>
<link href="fullscreenstyle.css" type="text/css" rel="stylesheet"></link>
<link href="pagestyle.css" type="text/css" rel="stylesheet"></link>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script>
<script src="jquery.fullscreenslides.js"></script>
</head>
<body>
<div class="wrapper">
<h1>jQuery HTML5 Fullscreen Slideshow</h1>
<p>This jQuery plugin lets you create fullscreen galleries where the slides are shown on the entire screen using the fullscreen APIs provided by Firefox 10+ and Chrome 15+ (and possibly Safari 5.1+).</p>
<p>In all other browsers it falls back to displaying the slideshow in the entire viewport.</p>
<h2>Example </h2>
<div style="height:0px;overflow:hidden">
<div class="image">
<a rel="gallery" title="Broadway Tower in Cotswolds, England" href="http://upload.wikimedia.org/wikipedia/commons/c/cb/Broadway_tower_edit.jpg">
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Broadway_tower_edit.jpg/200px-Broadway_tower_edit.jpg">
</a>
<div class="caption">
<a href="http://en.wikipedia.org/wiki/Broadway_Tower">
Broadway Tower in Cotswolds, England
</a>
<br>
Taken by Wikimedian
<a href="http://en.wikipedia.org/wiki/User:Newton2">
Newton2
</a>
</div>
</div>
<div class="image">
<a rel="gallery" title="New York City at Night, HDR" href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/New_York_City_at_night_HDR.jpg/1280px-New_York_City_at_night_HDR.jpg">
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/New_York_City_at_night_HDR.jpg/200px-New_York_City_at_night_HDR.jpg">
</a>
<div class="caption">
<a href="http://en.wikipedia.org/wiki/New_York">
New York City at Night, HDR
</a>
<br>
Taken by
<a href="http://www.flickr.com/people/paulobar/">
Paulo Barcellos Jr.
</a>
</div>
</div>
<div class="image">
<a rel="gallery" title="Red Squirrel with pronounced winter ear tufts" href="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Eichh%C3%B6rnchen_D%C3%BCsseldorf_Hofgarten_edit.jpg/1280px-Eichh%C3%B6rnchen_D%C3%BCsseldorf_Hofgarten_edit.jpg">
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Eichh%C3%B6rnchen_D%C3%BCsseldorf_Hofgarten_edit.jpg/200px-Eichh%C3%B6rnchen_D%C3%BCsseldorf_Hofgarten_edit.jpg">
</a>
<div class="caption">
<a href="http://en.wikipedia.org/wiki/Red_Squirrel">
Red Squirrel with pronounced winter ear tufts
</a>
<br>
Taken by Wikimedian
<a href="http://commons.wikimedia.org/wiki/User:Ray_eye">
Ray eye
</a>
</div>
</div>
</div>
<form class="hero-unit">
<fieldset>
<legend>Configure Slideshow</legend>
<label>Slide duration</label>
<input id="duration" type="text" value="8">
<label class="checkbox">
<input id="fadeCaption" type="checkbox">Fade out title
</label>
<label class="checkbox">
<input id="loopSlideShow" type="checkbox"> Repeat Slideshow
</label>
<button id="starter" class="btn btn-success">Start</button>
</fieldset>
</form>
<p>Pictures take from <a href="http://commons.wikimedia.org/wiki/Commons:Picture_of_the_Year/2007">Wikimedia Commons Picture of the Year 2007</a>.</p>
<h2>Usage</h2>
<pre id="code" class="prettyprint"></pre>
<h2>License</h2>
<p>© Copyright 2012 by <a href="http://eike.se/nd">Eike Send</a></p>
<p>The code is licensed under the <a href="MIT-LICENSE.txt">MIT</a> and the <a href="GPL-LICENSE.txt">GPLv2</a> Licenses, just like jQuery.</p>
<h2>Footnotes</h2>
<p>Learn more about the fullscreen API:</p>
<ul>
<li>
<a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">
WhatWG API draft
</a>
</li>
<li>
<a href="http://caniuse.com/#search=fullscreen">
"Can I use" compatibility table
</a>
</li>
<li>
<a href="https://developer.mozilla.org/en/DOM/Using_full-screen_mode">
Mozilla Developer Network documentation
</a>
</li>
</ul>
</div>
<script id="sample">
$(function(){
// initialize the slideshow
$('.image a[rel="gallery"]').fullscreenslides();
// All events are bound to this container element
var $container = $('#fullscreenSlideshowContainer');
var slideTimer = null;
var captionTimer = null;
var UiTimer = null;
var paused = false;
var duration;
var fadeCaption = false;
var loopSlideShow = false;
function nextSlide() {
if (slideTimer) window.clearInterval(slideTimer);
$container.trigger("nextSlide");
}
function hideCaption() {
if (captionTimer) window.clearInterval(captionTimer);
$('#fs-caption').fadeOut(500);
}
$container
//This is triggered once:
.bind("init", function() {
// The slideshow does not provide its own UI, so add your own
// check the fullscreenstyle.css for corresponding styles
$container
.append('<div class="ui ui-button" id="fs-close">×</div>')
.append('<div class="ui" id="fs-loader">Loading...</div>')
.append('<div class="ui ui-button" id="fs-prev"><</div>')
.append('<div class="ui ui-button" id="fs-next">></div>')
.append('<div class="ui ui-button" id="fs-pause">pause</div>')
.append('<div class="ui" id="fs-caption"><span></span></div>');
// Bind to the ui elements and trigger slideshow events
$('#fs-prev').click(function(){
// You can trigger the transition to the previous slide
$container.trigger("prevSlide");
});
$('#fs-next').click(function(){
// You can trigger the transition to the next slide
$container.trigger("nextSlide");
});
$('#fs-close').click(function(){
// You can close the slide show like this:
if (slideTimer) window.clearInterval(slideTimer);
if (captionTimer) window.clearInterval(captionTimer);
$container.trigger("close");
});
$('#fs-pause').click(function(){
// You can close the slide show like this:
if (!paused) {
if (slideTimer) window.clearInterval(slideTimer);
paused = true;
} else {
paused = false;
slideTimer = window.setInterval(nextSlide, duration);
}
});
})
// When a slide starts to load this is called
.bind("startLoading", function() {
// show spinner
$('#fs-loader').show();
})
// When a slide stops to load this is called:
.bind("stopLoading", function() {
// hide spinner
$('#fs-loader').hide();
})
// When a slide is shown this is called.
// The "loading" events are triggered only once per slide.
// The "start" and "end" events are called every time.
// Notice the "slide" argument:
.bind("startOfSlide", function(event, slide) {
// set and show caption
$('#fs-caption span').text(slide.title);
$('#fs-caption').show();
// this is to avoid race-conditions
if (slideTimer) window.clearInterval(slideTimer);
if (captionTimer) window.clearInterval(captionTimer);
if (!paused) slideTimer = window.setInterval(nextSlide, duration);
if (fadeCaption) captionTimer = window.setInterval(hideCaption,1500);
})
.bind("prevSlide nextSlide", function() {
if (slideTimer) window.clearInterval(slideTimer);
if (captionTimer) window.clearInterval(captionTimer);
})
// before a slide is hidden this is called:
.bind("endOfSlide", function(event, slide) {
$('#fs-caption').hide();
})
// When the slideshow closes this is called
.bind("close", function() {
if (slideTimer) window.clearInterval(slideTimer);
if (captionTimer) window.clearInterval(captionTimer);
if (UiTimer) window.clearInterval(UiTimer);
});
$("#starter").click(function(){
duration = parseInt($("#duration").val())*1000;
fadeCaption = $("#fadeCaption").is(':checked');
loopSlideShow = $("#loopSlideShow").is(':checked');
$container.trigger("setOptions",{noLoop : !loopSlideShow});
$container.trigger("start",["gallery",0]);
UiTimer = window.setInterval(function(){
$(".ui-button").hide();
window.clearInterval(UiTimer);
},2000);
$container.mousemove(function() {
if (!$("#fs-close").is(":visible")) {
$(".ui-button").show();
}
if (UiTimer) window.clearInterval(UiTimer);
UiTimer = window.setInterval(function(){
$(".ui-button").hide();
window.clearInterval(UiTimer);
},2000);
});
return false;
});
});
</script>
<!-- This is unrelated to the slideshow, it only creates the Usage section and other stuff: -->
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" type="text/css" rel="stylesheet"></link>
<script src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>
<script>
$(function() {
$('#code').text($('#sample').html());
prettyPrint();
});
</script>
<a href="http://github.com/eikes/jquery.fullscreen.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8283689-4']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>