slider.js 3.21 KB
Newer Older
Patrick's avatar
Patrick committed
1
2
3
4
5
6
7
8
var unconstrainedSlider = document.getElementById('unconstrained');
var unconstrainedValues = document.getElementById('unconstrained-values');
var value01html = document.getElementById('One')
var value02html = document.getElementById('Two')
var value03html = document.getElementById('Three')
var value04html = document.getElementById('Four')
var value05html = document.getElementById('Five')

Patrick's avatar
Patrick committed
9

Patrick's avatar
Patrick committed
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
noUiSlider.create(unconstrainedSlider, {
    start: [100, 200, 300, 400],
    // behaviour: 'unconstrained-tap',
    connect: [true, true, true, true, true],
    range: {
        'min': 0,
        'max': 500
    }
});

var connect = unconstrainedSlider.querySelectorAll('.noUi-connect');
var classes = ['c-1-color', 'c-2-color', 'c-3-color', 'c-4-color', 'c-5-color'];

for (var i = 0; i < connect.length; i++) {
     connect[i].classList.add(classes[i]);
}


unconstrainedSlider.noUiSlider.on('update', function (values) {
    // unconstrainedValues.innerHTML = values.join(' :: ');
    value01html.innerHTML = "min - " + values[0];
    value02html.innerHTML = values[0] + " - " + values[1];
    value03html.innerHTML = values[1] + " - " + values[2];
    value04html.innerHTML = values[2] + " - " + values[3];
    value05html.innerHTML = values[3] + " - max";

    var chk_ceil= document.getElementById("chxboxDemand");
Patrick's avatar
Patrick committed
37
38
39
    if (typeof chk_ceil === 'undefined'|| chk_ceil === null) {
        // the variable is defined
}else{
Patrick's avatar
Patrick committed
40
41
42
43
44
45
46
47
48
    if(chk_ceil.checked == true){

        heatdemVal01 = values[0];
        heatdemVal02 = values[1];
        heatdemVal03 = values[2];
        heatdemVal04 = values[3];

 
      highlightEnergy();
Patrick's avatar
Patrick committed
49
}}
Patrick's avatar
Patrick committed
50
51
});

Patrick's avatar
Patrick committed
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

var unconstrainedSlider2 = document.getElementById('unconstrained2');
var unconstrainedValues2 = document.getElementById('unconstrained-values2');
var value01html2 = document.getElementById('One2')
var value02html2 = document.getElementById('Two2')
var value03html2 = document.getElementById('Three2')
var value04html2 = document.getElementById('Four2')
var value05html2 = document.getElementById('Five2')


noUiSlider.create(unconstrainedSlider2, {
    start: [100, 200, 300, 400],
    // behaviour: 'unconstrained-tap',
    connect: [true, true, true, true, true],
    range: {
        'min': 0,
        'max': 500
    }
});

var connect2 = unconstrainedSlider2.querySelectorAll('.noUi-connect');
var classes2 = ['c-1-color', 'c-2-color', 'c-3-color', 'c-4-color', 'c-5-color'];

for (var i = 0; i < connect.length; i++) {
     connect2[i].classList.add(classes2[i]);
}


unconstrainedSlider2.noUiSlider.on('update', function (values) {
    // unconstrainedValues.innerHTML = values.join(' :: ');
    value01html2.innerHTML = "min - " + values[0];
    value02html2.innerHTML = values[0] + " - " + values[1];
    value03html2.innerHTML = values[1] + " - " + values[2];
    value04html2.innerHTML = values[2] + " - " + values[3];
    value05html2.innerHTML = values[3] + " - max";

    var chk_ceil2= document.getElementById("chxboxDemand");
    if (typeof chk_ceil2 === 'undefined'|| chk_ceil2 === null) {
        // the variable is defined
}else{
    if(chk_ceil2.checked == true){

        heatdemVal01 = values[0];
        heatdemVal02 = values[1];
        heatdemVal03 = values[2];
        heatdemVal04 = values[3];

 
      highlightEnergy();
}}
});