forked from l3dlp/touchless-js-cover-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
135 lines (120 loc) · 3.75 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cover Flow</title>
<link rel="stylesheet" href="coverflow.css"/>
</head>
<body>
<div id="enhancedby"><a href="https://gestures.io/"></a></div>
<div id="container"></div>
<script src="//cdn.gestures.io/js/gesturesio.js"></script> <!-- Just add the Gestures.IO library -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="coverflow.js"></script>
<script>
function reset() {
coverflow('container').remove();
//$('#container').coverflow({
coverflow('container').setup({
width: '100%',
item: 1,
// mousewheel: false,
// mode: 'flash',
// backgroundcolor: '009900',
// backgroundopacity: 0,
wmode: 'transparent',
// gradientcolor: 'ff0000',
// showduration: true,
playlist: 'playlist.json',
//playlist: 'http://api.flickr.com/services/feeds/groups_pool.gne?id=807213@N20&format=json&jsoncallback=?',
//route: {
// playlist: 'items',
// image: 'media.m'
//},
// playlist: [
// {
// "title": "snow-motion",
// "description": "what a massive and unbelievable winter we're having!",
// "image": "http://d3el35u4qe4frz.cloudfront.net/eawtAP1q-720.jpg",
// "link": "http://www.google.com/",
// "duration": "183"
// },
// {
// "title": "driving rain",
// "description": "",
// "image": "http://d3el35u4qe4frz.cloudfront.net/njZMLMwy-720.jpg",
// "duration": "782"
// },
// {
// "title": "winter brook",
// "description": "",
// "image": "http://d3el35u4qe4frz.cloudfront.net/Vg7cPUdl-720.jpg"
// }
// ],
coverwidth: 180,
coverheight: 150,
fixedsize: true,
textoffset: 50
})
.on('ready', function() {
//////////////////////////////////////
// And the magic of Gestures.IO begins
var GIO = G.IO();
GIO.init($('#container').width(), $('#container').height());
GIO.connect();
function onStatus(statusId, userId) {
switch (statusId) {
case 1:
GIO.addGesture('swipe', 'left_hand', 'x', 1, userId);
GIO.addGesture('swipe', 'left_hand', 'x', -1, userId);
GIO.addGesture('swipe', 'right_hand', 'x', 1, userId);
GIO.addGesture('swipe', 'right_hand', 'x', -1, userId);
break;
case 0:
break;
}
}
GIO.signalsManager.statusChanged.add(onStatus);
function onGesture(command, data) {
switch (parseInt(data.whichDirection)) {
case 1:
coverflow().prev();
break;
case -1:
coverflow().next();
break;
}
}
GIO.signalsManager.gestureDetected.add(onGesture);
// Gestures.IO-related code stops there
///////////////////////////////////////
this.on('focus', function(index) {
document.getElementById('focusindex').innerHTML = index;
});
this.on('click', function(index, link) {
document.getElementById('clickindex').innerHTML = index;
console.log(link);
if (link) {
window.open(link, '_blank');
}
});
});
}
reset();
</script>
<div style="width:480px;">
<div style="float:right;">Focused: <b id="focusindex">0</b> | Clicked: <b id="clickindex">0</b></div>
<p>
<a href="javascript:;" onclick="coverflow().left();">Left</a> - <a href="javascript:;" onclick="coverflow().right();">Right</a>
</p>
<p>
<a href="javascript:;" onclick="coverflow().prev();">Previous</a> - <a href="javascript:;" onclick="coverflow().next();">Next</a>
</p>
<p>
<input id="toval" value="0" size="1"> <a href="javascript:;" onclick="coverflow().to(document.getElementById('toval').value);">To</a>
</p>
</div>
<button onclick="reset();">Reset</button>
<button onclick="coverflow().remove();">Remove</button>
</body>
</html>