forked from fgnass/spin.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
70 lines (67 loc) · 1.88 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<title>spin.js</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
}
label {
display: inline-block;
width: 70px;
}
#preview {
background: #333;
color: #fff;
width: 200px;
height: 200px;
margin: 0 20px 20px 0;
border-radius: 10px;
}
</style>
</head>
<body>
<div id="preview"></div>
<form>
<label>Lines:</label><input type="range" name="lines" min="6" max="16" step="2" value="12"><br>
<label>Length:</label><input type="range" name="length" min="0" max="30" value="7"><br>
<label>Width:</label><input type="range" name="width" min="2" max="20" value="4"><br>
<label>Radius:</label><input type="range" name="radius" min="0" max="40" value="10"><br>
<label>Trail:</label><input type="range" name="trail" min="10" max="100" value="60"><br>
<label>Speed:</label><input type="range" name="speed" min="0.5" max="2.2" step="0.1" value="1"><br>
<label>Shadow:</label><input type="checkbox" name="shadow"><br>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="spin.js"></script>
<script>
$.fn.spin = function(opts) {
this.each(function() {
var $this = $(this),
data = $this.data();
if (data.spinner) {
data.spinner.stop();
delete data.spinner;
}
if (opts !== false) {
data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
}
});
return this;
};
function update() {
var opts = {};
$('input[min]').each(function() {
opts[this.name] = parseFloat(this.value);
});
$('input:checkbox').each(function() {
opts[this.name] = this.checked;
});
$('#preview').spin(opts);
}
$('input[min]').change(update);
$('input:checkbox').click(update);
update();
</script>
</body>
</html>