Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error, bootstrap-toggle can't render length when created in modal bootstrap #204

Open
baotrv opened this issue Oct 18, 2018 · 2 comments
Open

Comments

@baotrv
Copy link

baotrv commented Oct 18, 2018

Hi,
When i create one button toogle in boostrap , but it can't create length for the fit
Please help me.
untitled

@artbrare
Copy link

have the same problem :'(

@malle-pietje
Copy link

malle-pietje commented Jan 2, 2019

Struggling with the same issue. The quick and dirty fix is to make sure you initialize the toggle after the modal is shown, or if that's not possible, you can destroy/re-initialize the toggle after the modal was shown. You then need to also assign a width value.

Here's an example for a toggle inside an accordion element that is shown:

$('#collapse_id').on('shown.bs.collapse', function () {
    $('#input_with_toggle').bootstrapToggle('destroy').bootstrapToggle({
        size:     'small',
        onstyle:  'info',
        offstyle: 'default',
        width:    '52'
    });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants