-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.html
121 lines (111 loc) · 3.12 KB
/
buttons.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
<!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">
<head>
<title>uPrimer UI elements</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="ui.css" />
</head>
<body>
<div class="holder">
<h1>uPrimer UI elements</h1>
</div>
<hr />
<div id="buttons" class="holder">
<h3>Buttons</h3>
<div class="button icon onion"><a href="#">Løg!</a></div>
<div class="button"><a href="#">Less!</a></div>
<div class="button"><a href="#">Burgers!</a></div>
<div class="button"><a href="#" onclick="toggle(this);" title="Toggle on / off">Toggle me!</a></div>
<div class="button icon hand"><a href="#" onclick="raise();" title="Raise your hand">Raise hand</a></div>
<br style="clear:both"/>
<div class="button small"><a href="#" onclick="toggle(this);">Little</a></div>
<div class="button small"><a href="#">Mini</a></div>
<div class="button small"><a href="#">Button</a></div>
<div class="button small"><a href="#">Can you read me?</a></div>
</div>
<hr />
<div class="holder">
<h3>Text input</h3>
<input type="text" />
</div>
<hr />
<div class="holder">
<h3>Different</h3>
<label>
<input type="checkbox" />
Je suis un Check Le Box
</label>
<label>
<input type="checkbox" />
Je suis un Check Le Box
</label>
<label>
<input type="checkbox" />
Je suis un Check Le Box
</label>
</div>
<hr />
<div class="holder">
<h3>Interactive</h3>
<div class="progress">
<div class="wrap">
<div id="prog_1"></div>
</div>
</div>
</div>
<script>
var p = document.getElementById('prog_1');
var w = 0;
function raise() {
alert('raising your hand');
}
function run_progress() {
if (w <= 100) {
p.style.width = w + '%';
p.innerHTML = w + '%';
w++;
} else {
clearInterval(m);
}
}
var m = setInterval(run_progress, 50);
function toggle(el) {
var p = el.parentNode;
toggleClass(p);
}
function toggleClass(el) {
if (/toggle/.test(el.className)) {
removeClass(el, 'toggle');
} else {
addClass(el, 'toggle');
}
}
function addClass(el, str) {
/**************************
*
* Hyper simple function to add a class to a className - no checking, no
* nothing
*
**************************/
el.className = el.className + ' ' + str;
}
function removeClass(el, str) {
/**************************
*
* Simple function to remove class from className of element
*
**************************/
var cn = el.className.split(' ');
var l = cn.length;
var tempCn = [];
for (var i=0; i<l; i++) {
if (cn[i] != str) {
tempCn[tempCn.length] = cn[i];
}
}
el.className = tempCn.join(' ');
}
</script>
</body>
</html>