-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
163 lines (152 loc) · 4.51 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
<!doctype <!DOCTYPE html>
<html>
<head>
<title>CSS spinners</title>
<meta name="description" content="A gallery of pure CSS spinners and loading indicators" />
<meta name="keywords" content="css spinner loading indicator 3d" />
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
:focus {outline:none;}
body {
text-align: center;
background: url(bg.png);
height: 100%;
margin: 0;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
.controls {
position: absolute;
top: 0;
right: 0;
margin: 0.2em;
}
.button {
font-family: monospace;
border: none;
background: #333;
font-size: 2em;
padding: 0 0.2em 0.2em;
margin: 0.1em;
line-height: 0.8em;
color: #f0f0f0;
}
.button:hover {
background: #555;
}
.button:active {
background: black;
transform: translateY(2%);
}
.left { float: left; }
.right { float: right; }
.position {
font-family: monospace;
}
</style>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript">
$(function () {
// Gallery functionality
function mod(num, n) { return ((num % n) + n) % n; }
function setCurrentSpinner() {
$('.spinner').remove();
$spinners.eq(current).appendTo($('body'));
$pos.text((current + 1) + ' / ' + $spinners.length);
}
function setSpinnerInDirection(dir) {
current = mod(current + dir, $spinners.length);
location.hash = '#' + $spinners.eq(current).attr('id');
}
var current = 0;
var $spinners = $('.spinner').remove();
var $controls = $('.controls');
[{ cls: 'left', html: '←', dir: -1, }, { cls: 'right', html: '→', dir: 1, } ].forEach(function (btn) {
$('<button>')
.addClass(btn.cls + ' button')
.html(btn.html)
.appendTo($controls)
.on('click', setSpinnerInDirection.bind(null, btn.dir));
});
var $pos = $('<div>').addClass('position').appendTo($controls);
$(document).on('keydown', function (ev) {
var dir = { 37: -1, 39: 1, }[ev.which];
dir && setSpinnerInDirection(dir);
});
// Hash navigation
var $win = $(window).on('hashchange', function (ev) {
current = $spinners.index($spinners.filter(location.hash));
if (current < 0) {
location.hash = '#' + $spinners.eq(0).attr('id');
} else {
setCurrentSpinner();
}
});
location.hash.substr(1) ?
$win.trigger('hashchange') :
(location.hash = '#' + $spinners.eq(current).attr('id'));
});
</script>
</head>
<body>
<div class="controls"></div>
<div class="spinner windcatcher" id="windcatcher">
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
<div class="blade"></div>
</div>
<div class="spinner slabs" id="slabs">
<div class="slab"></div>
<div class="slab"></div>
<div class="slab"></div>
<div class="slab"></div>
</div>
<div class="spinner newton" id="newton">
<div class="ball"></div><div class="ball"></div><div class="ball"></div><div class="ball"></div><div class="ball"></div>
</div>
<div class="spinner clock" id="clock">
<div class="shadow"></div>
<div class="dial">
<div class="hour hand"></div>
<div class="minute hand"></div>
</div>
</div>
<div class="spinner sphere" id="sphere">
<div class="inner">
<div class="disc"></div>
<div class="disc"></div>
<div class="disc"></div>
</div>
</div>
<div class="spinner colorwheel" id="colorwheel">
<div class="centerpiece"></div>
</div>
<div class="spinner infinity" id="infinity">
<div class="half">
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
</div>
<div class="half">
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
<div class="marker"></div>
</div>
</div>
</body>
</html>