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

the option size is doesn't work? #685

Open
jerry-yuan opened this issue Sep 26, 2018 · 7 comments
Open

the option size is doesn't work? #685

jerry-yuan opened this issue Sep 26, 2018 · 7 comments

Comments

@jerry-yuan
Copy link

No matter whether I use the $(...). bootstrapSwitch ({size:"small"}) or add data-size = "small" to the input, I can't achieve small space. By the way, I found that there are lots of bootstrap-switch-undefined in the class attribute of wrapper which contains the switch elements.

@WebCustoms
Copy link

WebCustoms commented Oct 8, 2018

I have the same problem.
i use the CSS file and not the less file.

@matusmark
Copy link

CSS and JS are v.3.3.4 on the demo site as in the repository, but the version on the site works!
bootstrap-switch.js
bootstrap-switch.css

@woodynew
Copy link

woodynew commented Nov 9, 2018

https://github.com/Bttstrp/bootstrap-switch/blob/master/dist/js/bootstrap-switch.js

function getClasses(options, id) {
    var state = options.state,
        size = options.size,
        disabled = options.disabled,
        readonly = options.readonly,
        indeterminate = options.indeterminate,
        inverse = options.inverse;

    return [state ? 'on' : 'off', size, disabled ? 'disabled' : undefined, readonly ? 'readonly' : undefined, indeterminate ? 'indeterminate' : undefined, inverse ? 'inverse' : undefined, id ? 'id-' + id : undefined].filter(function (v) {
      return v == null;
    });
  }

be revised as

function getClasses(options, id) {
    var state = options.state,
        size = options.size,
        disabled = options.disabled,
        readonly = options.readonly,
        indeterminate = options.indeterminate,
        inverse = options.inverse;

    return [state ? 'on' : 'off', size, disabled ? 'disabled' : undefined, readonly ? 'readonly' : undefined, indeterminate ? 'indeterminate' : undefined, inverse ? 'inverse' : undefined, id ? 'id-' + id : undefined].filter(function (v) {
      return v != null;
    });
  }

Returns the option of null:
return v == null;

So it's all undefined

@woodynew
Copy link

woodynew commented Nov 9, 2018

@matusmark bootstrap-switch. Js is right

@insmod
Copy link

insmod commented Feb 7, 2019

@Wong-Dy you are correct, please submit a pull-request because it works as intended just by changing that

@jybleau
Copy link

jybleau commented Sep 19, 2019

FYI Fixed by #713
Still waiting for this PR to be merged.

@zhaowenquan131
Copy link

zhaowenquan131 commented Mar 19, 2020

https://github.com/Bttstrp/bootstrap-switch/blob/master/dist/js/bootstrap-switch.js

function getClasses(options, id) {
    var state = options.state,
        size = options.size,
        disabled = options.disabled,
        readonly = options.readonly,
        indeterminate = options.indeterminate,
        inverse = options.inverse;

    return [state ? 'on' : 'off', size, disabled ? 'disabled' : undefined, readonly ? 'readonly' : undefined, indeterminate ? 'indeterminate' : undefined, inverse ? 'inverse' : undefined, id ? 'id-' + id : undefined].filter(function (v) {
      return v == null;
    });
  }

be revised as

function getClasses(options, id) {
    var state = options.state,
        size = options.size,
        disabled = options.disabled,
        readonly = options.readonly,
        indeterminate = options.indeterminate,
        inverse = options.inverse;

    return [state ? 'on' : 'off', size, disabled ? 'disabled' : undefined, readonly ? 'readonly' : undefined, indeterminate ? 'indeterminate' : undefined, inverse ? 'inverse' : undefined, id ? 'id-' + id : undefined].filter(function (v) {
      return v != null;
    });
  }

Returns the option of null:
return v == null;

So it's all undefined

I had a try as this just, but it seems not to work

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

7 participants