-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
100 lines (82 loc) · 2.73 KB
/
script.js
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
$(document).ready(function () {
// Single
InitializeRoundSlider({
"id": "round-slider-single",
"radius": 100,
"borderWidth": 3,
"borderColor": "#000000",
"handleSize": 30,
"handleColor": "#337ab7"
});
updateRoundSliderValue("#round-slider-single", 0.25);
// Double
InitializeRoundSlider({
"id": "round-slider-double-1",
"radius": 80,
"borderWidth": 1,
"borderColor": "#000000",
"handleSize": 30,
"handleColor": "#5cb85c"
});
updateRoundSliderValue("#round-slider-double-1", 0);
InitializeRoundSlider({
"id": "round-slider-double-2",
"radius": 80,
"borderWidth": 1,
"borderColor": "#000000",
"handleSize": 30,
"handleColor": "#f0ad4e"
});
updateRoundSliderValue("#round-slider-double-2", 0.5);
// Parent-child parent
InitializeRoundSlider({
"id": "round-slider-parent",
"radius": 100,
"borderWidth": 2,
"borderColor": "#000000",
"handleSize": 30,
"handleColor": "#5bc0de"
});
// Adding child
$("#round-slider-parent > #result-handle").append('<div id="round-slider-child"></div>');
$("#round-slider-parent > #result-handle").css("overflow", "visible");
// Parent-child child
InitializeRoundSlider({
"id": "round-slider-child",
"radius": 50,
"borderWidth": 1,
"borderColor": "#000000",
"handleSize": 15,
"handleColor": "#d9534f",
});
$("#round-slider-child").css("position", "absolute");
$("#round-slider-child").css({
"transform" : "translate(-50%,-50%)",
"-ms-transform" : "translate(-50%,-50%)",
"-webkit-transform" : "translate(-50%,-50%)",
"-moz-transform" : "translate(-50%,-50%)",
"-o-transform" : "translate(-50%,-50%)"
});
$("#round-slider-child").css("top", "50%");
$("#round-slider-child").css("left", "50%");
updateRoundSliderValue("#round-slider-parent", 0);
updateRoundSliderValue("#round-slider-child", 0.75);
});
// Event after value changing
function roundSliderOnValueChanged(target, value) {
if (target.attr("id") === "round-slider-single") {
$("#text-slider-value-single").text(value);
}
if (target.attr("id") === "round-slider-double-1") {
$("#text-slider-value-double-1").text(value);
}
if (target.attr("id") === "round-slider-double-2") {
$("#text-slider-value-double-2").text(value);
}
if (target.attr("id") === "round-slider-parent") {
$("#text-slider-value-parent").text(value);
}
if (target.attr("id") === "round-slider-child") {
$("#text-slider-value-child").text(value);
}
}