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

Can be done with pure CSS and less code #13

Closed
ProLoser opened this issue Jan 10, 2014 · 11 comments
Closed

Can be done with pure CSS and less code #13

ProLoser opened this issue Jan 10, 2014 · 11 comments

Comments

@ProLoser
Copy link

Here's a demo:

http://jsfiddle.net/ProLoser/bM4C9/

Doesn't require Javascript and should have excellent browser support. I tend to prefer declaring the colors in CSS instead of JS anyway.

@abpetkov
Copy link
Owner

Of course it can be done in pure CSS. It's a matter of personal preference. Some people prefer to write 3 lines of JS, instead of 30 in CSS.

@ProLoser
Copy link
Author

OR you could refactor your version so that click events are properly emitted and your javascript gets reduced to just tweaking the css and generating the html instead of event binding.

@abpetkov
Copy link
Owner

Thanks for your feedback, I find it very useful, especially from someone experienced like you. I'll consider it when making further changes to the component.

@aj0strow
Copy link

@ProLoser thank you, that's rather elegant.

@vkammerer
Copy link

So much better in CSS! thank you @ProLoser

@damianof
Copy link

@ProLoser are you going to create a repo with your css solution?

@ProLoser
Copy link
Author

@damianof no because it's not something people should be including into their project as a 3rd party lib, just learn css. At best I would throw it on a tips and tricks collection

@damianof
Copy link

Maybe a repo of CSS snippets....

ashrafsabrym added a commit to OneToOneService/AdminLTE that referenced this issue Jun 12, 2019
@bobbyg603
Copy link

Here's a demo:

http://jsfiddle.net/ProLoser/bM4C9/

Doesn't require Javascript and should have excellent browser support. I tend to prefer declaring the colors in CSS instead of JS anyway.

Hey @ProLoser , do you have a copy of this CSS you might share? unfortunately this jsfiddle seems to have been lost in the river of time. Thank you!

@ProLoser
Copy link
Author

@bobbyg603 Google "css switch"

https://freefrontend.com/css-toggle-switches/

@bobbyg603
Copy link

thanks @ProLoser i ended up finding one, here's the one i went with for anyone looking at this thread in the future https://codepen.io/TazTheManiac/pen/rGrpMg

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

6 participants