jQRangeSlider icon indicating copy to clipboard operation
jQRangeSlider copied to clipboard

DateRangeSlider Resize

Open cpear opened this issue 11 years ago • 6 comments
trafficstars

It appears that resize is only available for the RangeSlider and not the DateRangeSlider. IS the only option to completely destroy the timeline and rebuild to have new bounds take effect?

cpear avatar Jul 16 '14 14:07 cpear

Resize is available for all slider, all you have to do is to call it with the proper method:

 $("#slider").dateRangeSlider("resize")
 // instead of
 $("#slider").rangeSlider("resize")

ghusse avatar Jul 17 '14 06:07 ghusse

date range slider resize is not working for me. $scope.initSlider = function () { //$('#dateRulersExample').dateRangeSlider('resize'); $(function () { var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];

            // wait till load event fires so all resources are available
            that.$dateRulersExample = $("#dateRulersExample").dateRangeSlider({
                bounds: {min: new Date(2011, 0, 1), max: new Date(2012, 11, 31, 12, 59, 59)},
                defaultValues: {min: new Date(2012, 1, 10), max: new Date(2012, 4, 22)},
                scales: [{
                    first: function(value){ return value; },
                    end: function(value) {return value; },
                    next: function(value){
                        var next = new Date(value);
                        return new Date(next.setMonth(value.getMonth() + 1));
                    },
                    label: function(value){
                        return months[value.getMonth()];
                    },
                    format: function(tickContainer, tickStart, tickEnd){
                        tickContainer.addClass("myCustomClass");
                    },
                    step:{
                        months: 24
                    }
                }]
            });
        });
       $('#dateRulersExample').dateRangeSlider('resize');
    };
    $scope.initSlider();

maddy25 avatar Aug 15 '16 14:08 maddy25

You have to call it only once the container becomes available

Le 15 août 2016 4:04 PM, "maddy25" [email protected] a écrit :

date range slider resize is not working for me. $scope.initSlider = function () { //$('#dateRulersExample').dateRangeSlider('resize'); $(function () { var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];

        // wait till load event fires so all resources are available
        that.$dateRulersExample = $("#dateRulersExample").dateRangeSlider({
            bounds: {min: new Date(2011, 0, 1), max: new Date(2012, 11, 31, 12, 59, 59)},
            defaultValues: {min: new Date(2012, 1, 10), max: new Date(2012, 4, 22)},
            scales: [{
                first: function(value){ return value; },
                end: function(value) {return value; },
                next: function(value){
                    var next = new Date(value);
                    return new Date(next.setMonth(value.getMonth() + 1));
                },
                label: function(value){
                    return months[value.getMonth()];
                },
                format: function(tickContainer, tickStart, tickEnd){
                    tickContainer.addClass("myCustomClass");
                },
                step:{
                    months: 24
                }
            }]
        });
    });
   $('#dateRulersExample').resize();
};
$scope.initSlider();

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ghusse/jQRangeSlider/issues/173#issuecomment-239809983, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgLjcAtf1Mbop1QHgBdI8ih3WlcjSOhks5qgHH5gaJpZM4CNxF- .

ghusse avatar Aug 15 '16 14:08 ghusse

image

After I resize the window image

maddy25 avatar Aug 15 '16 14:08 maddy25

Looks like the class ui-rangeSlider-innerBar is not added until we resize the window. any idea why it might be happening?

maddy25 avatar Aug 15 '16 15:08 maddy25

Figured it out.

maddy25 avatar Aug 16 '16 14:08 maddy25