bootstrap-slider icon indicating copy to clipboard operation
bootstrap-slider copied to clipboard

Question : why ticks label are not in the tick HTML element ?

Open Pontax opened this issue 6 years ago • 2 comments

Hello, My problem is that I'm in horizontal orientation and I would like to adapt the slider's width to the parent. So, I've set the width to 100% but the tick' labels have a calculated width in px and before a click or a window resize, labels are wrong-positioned, while ticks a well positioned.

After looking at source code, I have a question : why the HTML element corresponding to the label is not inside the HTML element representing the tick ?

Pontax avatar Jan 22 '19 07:01 Pontax

Try calling refresh on the slider instance after resizing is done.

seiyria avatar Jan 22 '19 13:01 seiyria

OK, I have called the refresh method on the window.load event. I could tell that it's working but I have a blinking display : labels are shown at a first position, then the refresh occurs and move the labels at their right positions.

Why don't you instantiate the slider on this event ? This way, the size of elements is known and tick labels will be well positioned.

var self = this;
$(window).load(function(){
    instance = new PluginClass( self, options );
    $.data( self, namespace, instance );
});

Pontax avatar Jan 22 '19 15:01 Pontax