slider.js 2.54 KB
Newer Older
Patrick's avatar
Patrick committed
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
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')

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
36
37
38
    if (typeof chk_ceil === 'undefined'|| chk_ceil === null) {
        // the variable is defined
}else{
Patrick's avatar
Patrick committed
39
40
41
42
43
44
45
46
47
    if(chk_ceil.checked == true){

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

 
      highlightEnergy();
Patrick's avatar
Patrick committed
48
}}
Patrick's avatar
Patrick committed
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
});

// var testingslider = document.getElementById('slider-color');

// noUiSlider.create(testingslider, {
//     start: slidervalues = [60, 100, 200, 300],
//     connect: [true, true, true, true, true],
//     range: {
//         'min': [0],
//         'max': [600]
//     }
// });

// var connect = testingslider.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]);
// }


// function checkSlider(){

// }
// // Display the slider value and how far the handle moved
// // from the left edge of the slider.
// range.noUiSlider.on('update', function (values) {
//     // valuesDivs[handle].innerHTML = values[handle];
//     // diffDivs[0].innerHTML = values[1] - values[0];
//     // diffDivs[1].innerHTML = values[2] - values[1];
//     // diffDivs[2].innerHTML = values[3] - values[2];
//     alert(values[0])
// });