This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
191 lines (165 loc) · 5.56 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>TvNavigationController example</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="TvNavigationController.js"></script>
<style type="text/css">
body {
width: 632px;
border: 1px dashed black;
margin: 0 auto;
padding: 20px;
}
#zone1, #zone2, #zone3 {
border: 1px solid black;
padding: 10px;
overflow: hidden;
margin: 0;
}
#zone2 {
width: 486px;
margin: 20px 0 0 0;
}
#zone2 ul {
overflow: hidden;
padding: 0 0 10px 0;
margin: 0;
}
#zone3 {
width: 52px;
float: right;
margin: 20px 0 0 0;
}
li {
float: left;
list-style: none;
}
a {
display: block;
text-decoration: none;
width: 50px;
height: 50px;
border: 1px solid black;
margin-right: 10px;
}
#zone3 a {
margin: 0 0 10px 0;
}
.last, #zone3 a.last, #zone2 ul.last {
margin: 0px;
padding-bottom: 0px;
}
.selected {
border: 1px solid red;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function()
{
var that = this;
var zone1_items = jQuery('#zone1 .item');
var zone2_items = jQuery('#zone2 .item');
var zone3_items = jQuery('#zone3 .item');
this.nav_controller = new TvNavigationController('item', 'selected');
jQuery('.item').on('click', function(e)
{
e.preventDefault();
that.nav_controller.selectItem(zone1_items.first());
});
this.nav_controller.addZone('#zone1', 'row', {
up: {},
down: zone2_items.first()
},
function(current_item, next_item)
{
if (next_item.hasClass('skip'))
{
next_item.text('skipped');
next_item = (current_item.hasClass('prev')) ? jQuery('.next') : jQuery('.prev');
}
return next_item;
});
this.nav_controller.addZone('#zone2', 'grid', {
left: zone3_items.first(),
right: zone3_items.first(),
up: zone1_items.first(),
down: zone1_items.first()
});
this.nav_controller.addZone('#zone3', 'col', {
left: function(current_item)
{
if (current_item.is(zone3_items.last()))
{
return zone2_items.last();
}
return zone2_items.first();
},
right: function(current_item)
{
if (current_item.is(zone3_items.last()))
{
return zone2_items.first();
}
return zone2_items.first();
},
up: zone1_items.last(),
down: zone1_items.last()
});
this.nav_controller.start(zone1_items.first());
});
</script>
</head>
<body>
<ul id="zone1">
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item prev" href="#"> </a><li>
<li><a class="item skip" href="#"> </a><li>
<li><a class="item next" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item last" href="#"> </a><li>
</ul>
<ul id="zone3">
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item last" href="#"> </a><li>
</ul>
<div id="zone2">
<ul class="item_row">
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item last" href="#"> </a><li>
</ul>
<ul class="item_row">
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item last" href="#"> </a><li>
</ul>
<ul class="item_row last">
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item" href="#"> </a><li>
<li><a class="item last" href="#"> </a><li>
</ul>
</div>
</body>
</html>