Open neandr opened 3 years ago
I have a similar issue where I have bootstrap tabs (11 of them) with a various amount of toggles on each tab. When the page loads the first tab appears fine and the style of the div that is generate sets the correct width. However if you change tabs, or inspect in the code, all the toggles on the other tabs have are rendered as <div class="toggle btn btn-success" data-toggle="toggle" role="button" style="width: 0px; height: 0px;">
@Steven Did you tried to use the $(document).ready(function() { } mentioned with my post? Just looked into my code again, there I added
// The text length of data-on/data-off on the 'modal' cannot be
// calculated as long as it is not open, so it is set to 'width:0px';
// When the modal is opened, the 'style' is calculated:
$('#mutedOp')[0].children[1].setAttribute('style',"width:80px")
(also to remind myself about the issue ;) )
.. but still waiting for another, better solution ...
Yeah I ended up fixing it by simply adding these CSS classes to set the height and width that I need
.tab-pane .toggle, .modal .toggle{
min-width: 75.1791px !important; height: 35.597px !important;
}
bootstrap-toggle "toggleDevice" generates
width:0px
only. It's not scaling correctly for the text length of data-on/data-off. The code used:This generates:
To get it better using ... this hack could do it
... but should be better?!
Version used: Toggle.VERSION = '2.2.0'