-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
46 lines (40 loc) · 1.58 KB
/
main.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
$(function (){
var slider = document.getElementById('sliderStatus');
var message = document.getElementById('sliderMessage');
slider.classList.remove("orange","yellow","lightgreen","green");
function sliderChange(callback){
if (slider.value <= 9) {
message.innerHTML = "Неделава беше ужасна...";
message.style.color = "red";
slider.style.background = "#ed1c24"; //<-- red
slider.classList.add("red");
slider.classList.remove("orange");
} else if (slider.value <= 39){
message.innerHTML = "Можеше и подобро.";
message.style.color = "#ff7f27";
slider.style.background = "#ff7f27";//<-- orange
slider.classList.add("orange");
slider.classList.remove("yellow");
} else if (slider.value <= 60){
message.innerHTML = "Уште една обична работна недела.";
message.style.color = "#fff200";
slider.style.background = "#fff200";//<-- yellow
slider.classList.add("yellow");
slider.classList.remove("lightgreen");
} else if (slider.value <= 90){
message.innerHTML = "Забавно беше.";
message.style.color = "#7aff0e";
slider.style.background = "#7aff0e";//<--lightgreen
slider.classList.add("lightgreen");
slider.classList.remove("green");
} else if (slider.value <= 100){
message.innerHTML = "WOW, одлична недела.";
message.style.color = "#0ed145";
slider.style.background = "#0ed145";//<--green
slider.classList.add("green");
}
}
slider.addEventListener('input', function(){
sliderChange(callback());
});
});