-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.js
95 lines (90 loc) · 3.15 KB
/
demo.js
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
/*
* blueimp Gallery Demo JS 2.11.1
* https://github.com/blueimp/Gallery
*
* Copyright 2013, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
/* global blueimp, $ */
$(function () {
'use strict';
// Load demo images from flickr:
$.ajax({
url: 'https://api.flickr.com/services/rest/',
data: {
format: 'json',
method: 'flickr.interestingness.getList',
api_key: '7617adae70159d09ba78cfec73c13be3' // jshint ignore:line
},
dataType: 'jsonp',
jsonp: 'jsoncallback'
}).done(function (result) {
var carouselLinks = [],
linksContainer = $('#links'),
baseUrl;
// Add the demo images as links with thumbnails to the page:
$.each(result.photos.photo, function (index, photo) {
baseUrl = 'http://farm' + photo.farm + '.static.flickr.com/' +
photo.server + '/' + photo.id + '_' + photo.secret;
$('<a/>')
.append($('<img>').prop('src', baseUrl + '_s.jpg'))
.prop('href', baseUrl + '_b.jpg')
.prop('title', photo.title)
.attr('data-gallery', '')
.appendTo(linksContainer);
carouselLinks.push({
href: baseUrl + '_c.jpg',
title: photo.title
});
});
// Initialize the Gallery as image carousel:
blueimp.Gallery(carouselLinks, {
container: '#blueimp-image-carousel',
carousel: true
});
});
// Initialize the Gallery as video carousel:
blueimp.Gallery([
{
title: 'Sintel',
href: 'http://media.w3.org/2010/05/sintel/trailer.mp4',
type: 'video/mp4',
poster: 'http://media.w3.org/2010/05/sintel/poster.png'
},
{
title: 'Big Buck Bunny',
href: 'http://upload.wikimedia.org/wikipedia/commons/7/75/' +
'Big_Buck_Bunny_Trailer_400p.ogg',
type: 'video/ogg',
poster: 'http://upload.wikimedia.org/wikipedia/commons/thumb/7/70/' +
'Big.Buck.Bunny.-.Opening.Screen.png/' +
'800px-Big.Buck.Bunny.-.Opening.Screen.png'
},
{
title: 'Elephants Dream',
href: 'http://upload.wikimedia.org/wikipedia/commons/transcoded/8/83/' +
'Elephants_Dream_%28high_quality%29.ogv/' +
'Elephants_Dream_%28high_quality%29.ogv.360p.webm',
type: 'video/webm',
poster: 'http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/' +
'Elephants_Dream_s1_proog.jpg/800px-Elephants_Dream_s1_proog.jpg'
},
{
title: 'LES TWINS - An Industry Ahead',
type: 'text/html',
youtube: 'zi4CIXpx7Bg'
},
{
title: 'KN1GHT - Last Moon',
type: 'text/html',
vimeo: '73686146',
poster: 'http://b.vimeocdn.com/ts/448/835/448835699_960.jpg'
}
], {
container: '#blueimp-video-carousel',
carousel: true
});
});