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

The tick labels are not correctly positioned when the slider is used in a Bootstrap Nav tabs

Open pgksunilkumar opened this issue 8 years ago • 12 comments

image

pgksunilkumar avatar Dec 14 '16 11:12 pgksunilkumar

I have a temporary solution to a problem which I am working on. For better understanding, I am sharing the Code.

CSS Code : .slider.slider-horizontal .slider-tick-label-container .slider-tick-label{ width: 35 !important; }

Kindly request someone to help with the permanent solution in javascript

pgksunilkumar avatar Dec 14 '16 12:12 pgksunilkumar

please provide a jsfiddle so we can see your environment

seiyria avatar Dec 14 '16 13:12 seiyria

JSFiddle here, 4 tabls with a slider on each tab, initial tab always renders correctly https://jsfiddle.net/sergpro/126mebfm/

sergproua avatar Dec 21 '16 17:12 sergproua

thanks for sharing the jsfiddle sergproua

may be if you need urgent use this jsfiddle but it is temporary solution

https://jsfiddle.net/pgksunilkumar/126mebfm/17/

pgksunilkumar avatar Dec 22 '16 10:12 pgksunilkumar

Hi @pgksunilkumar, i tried your solution but it breaks positioning of the tick labels. Hi @seiyria, any chance of suggesting a true workaround for this? Thanks!

sergproua avatar Dec 22 '16 17:12 sergproua

Unfortunately, I mostly just maintain the repo and act as a first responder to filter out issues. Sorry!

seiyria avatar Dec 22 '16 17:12 seiyria

hi, since the example is already provided can labels be changed to bug, etc? Hoping this would get more attention.

sergproua avatar Jan 07 '17 11:01 sergproua

@sergproua we would welcome a PR to address this. thanks!

rovolution avatar Jan 07 '17 15:01 rovolution

I think it happen each time an slider start hidden, width (and height) have issue with hidden element or elements inside an hidden element. Think a shown.bs.tab event call can do the trick.

Easy workaround : do the slider only when needed : https://jsfiddle.net/nc7s2qf9/

Shnoulle avatar Jan 09 '17 16:01 Shnoulle

I've revised the example where refresh method is called on a slider - https://jsfiddle.net/sergpro/126mebfm/ Reaching out to jQuery/Bootstrap experts who knows how to make Slider refresh when component is hidden/shown

sergproua avatar Jan 15 '17 17:01 sergproua

Perhaps I am overlooking something obvious here, but everything (that I've tried) seems to work simply by wrapping the slider initialization within Bootstrap's shown.bs.tab event handler:

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
    $('#ex1').slider({
        formatter: function(value) {
            return 'Current value: ' + value;
        }
    });
})

I'm able to switch tabs without issue, and the slider properties are retained between tab-switches. I even have two sets of tabs (each wrapped in an accordion) and everything still works fine...

cbj4074 avatar Feb 01 '17 21:02 cbj4074

Maybe a little late but I had the same problem.

What fixed it for me was when a parent had the "display: none" attribute. If you hide something do it with JQuery, this fixed it for me!

michaelvaneck avatar Jul 26 '17 06:07 michaelvaneck