This repository was archived by the owner on Apr 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
116 lines (99 loc) · 2.32 KB
/
example.html
File metadata and controls
116 lines (99 loc) · 2.32 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
<!doctype html>
<html>
<head>
<title>Cycle</title>
<script src='build/build.js'></script>
<style>
body {
padding: 80px;
font-weight: 200;
font-family: 'Helvetica Neue';
}
p {
color: #666;
}
h2 {
font-weight: inherit;
}
.cycle {
width: 150px;
overflow: hidden;
position: relative;
text-align: center;
-webkit-user-select: none;
}
.cycle ul {
top: 0px;
position: relative;
list-style: none;
transition: top .2s ease;
}
.cycle li {
cursor: pointer;
transition: opacity .5s ease;
padding: 4px 0;
opacity: .3;
}
.cycle li:hover {
opacity: .5;
}
.cycle .selected {
opacity: 1;
cursor: default;
}
.cycle::before {
position: absolute;
right: 0;
left: 40px;
top: 38px;
content: '\0';
padding: 4px 0;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
display: block;
background: #fff;
}
.cycle .cycle-focus {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
height: 24px;
left: 40px;
top: 40px;
display: block;
}
.cycle .selected:hover {
opacity: 1;
}
</style>
</head>
<body>
<h2>Choose a language</h2>
<p>Use you're mousewheel, keyboard up down, or just click.</p>
<div class='cycle'>
<ul>
<li data-id='1'>Google Go</li>
<li data-id='2' class='selected'>Javascript</li>
<li data-id='3'>Lua</li>
<li data-id='4'>Julia</li>
<li data-id='5'>Erlang</li>
<li data-id='6'>C</li>
<li data-id='7'>Other</li>
</ul>
</div>
<script>
var el = document.querySelector('ul')
, k = require('k')(window)
, Cycle = require('cycle')
, cycle = new Cycle(el);
// on select
cycle.on('select', function(el){
var id = el.getAttribute('data-id');
var name = el.innerText;
console.log('you have selected %s: %s', id, name);
});
// map shortcuts
k('down', cycle.down.bind(cycle));
k('up', cycle.up.bind(cycle));
</script>
</body>
</html>