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

When a checkbox is not displayed, switchery doesn't work well #23

Closed
martin-hoger opened this issue Feb 25, 2014 · 6 comments
Closed

When a checkbox is not displayed, switchery doesn't work well #23

martin-hoger opened this issue Feb 25, 2014 · 6 comments

Comments

@martin-hoger
Copy link

First of all, thank you for the plugin!

I just deal with an issue which is more problem of html and js itself, when the checkbox is not displayed, switchery doesn't work well:

record-2014-02-25--ia4v70

The topic has been already discussed quite a lot:
http://stackoverflow.com/questions/1841124/find-the-potential-width-of-a-hidden-element
http://stackoverflow.com/questions/1472303/jquery-get-width-of-element-when-not-visible-display-none

I would say to clone and show and hide element is not really an elegant solution, if there are a really lot of checkboxes on the page it might be even performance issue, etc... But what about to add a parameter in settings in js, which would be used if the real width or height cannot be read?

I believe other users would appreciate this feature as well.

@jimmyandrade
Copy link

I'm going through the same problem.

@abpetkov
Copy link
Owner

I'll get into that in the next few days and fix it in the next version.

@abpetkov
Copy link
Owner

Fixed in 0.5.1.

Cheers.

@martin-hoger
Copy link
Author

Thanks a lot!

I have got one more idea. What about to call events from the switchery element on the source checkbox? If I use switchery for an existing app, I might have already some events attached on the checkbox. For inst. switchery would call onchange() on the checkbox if the state of switchery was changed and so on....
Just an idea.

@abpetkov
Copy link
Owner

I'm not sure if I understand you correct, but currently an onchange event is triggered on the checkbox from the switchery element. There is an example on the demo page under the section "Checking state / On change".

If you mean something else, please give me a more detailed example or some real-world situation, so that I could understand better.

@martin-hoger
Copy link
Author

I meant exactly the same thing. Sorry, I had to overlook it.

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