hjg
2024-01-17 efbf825aa2f845bc6f9b26b0fa10139c8071deef
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
var UIIonSliders = function () {
 
    return {
        //main function to initiate the module
        init: function () {
 
            $("#range_1").ionRangeSlider({
                min: 0,
                max: 5000,
                from: 1000,
                to: 4000,
                type: 'double',
                step: 1,
                prefix: "$",
                prettify: false,
                hasGrid: true
            });
 
            $("#range_2").ionRangeSlider();
 
            $("#range_5").ionRangeSlider({
                min: 0,
                max: 10,
                type: 'single',
                step: 0.1,
                postfix: " mm",
                prettify: false,
                hasGrid: true
            });
 
            $("#range_6").ionRangeSlider({
                min: -50,
                max: 50,
                from: 0,
                type: 'single',
                step: 1,
                postfix: "°",
                prettify: false,
                hasGrid: true
            });
 
            $("#range_4").ionRangeSlider({
                type: "single",
                step: 100,
                postfix: " light years",
                from: 55000,
                hideText: true
            });
            
            $("#range_3").ionRangeSlider({
                type: "double",
                postfix: " miles",
                step: 10000,
                from: 25000000,
                to: 35000000,
                onChange: function(obj){
                    var t = "";
                    for(var prop in obj) {
                        t += prop + ": " + obj[prop] + "\r\n";
                    }
                    $("#result").html(t);
                }
            });
 
            $("#updateLast").on("click", function(){
 
                $("#range_3").ionRangeSlider("update", {
                    min: Math.round(10000 + Math.random() * 40000),
                    max: Math.round(200000 + Math.random() * 100000),
                    step: 1,
                    from: Math.round(40000 + Math.random() * 40000),
                    to: Math.round(150000 + Math.random() * 80000)
                });
 
            });
            
        }
 
    };
 
}();