switchery icon indicating copy to clipboard operation
switchery copied to clipboard

Add `is-selected` class when switch is ON

Open vfonic opened this issue 10 years ago • 2 comments

Hi,

Great work on switchery! Thanks!

I'm using SASS for my CSS and along with it, I've got some branding colors set through SASS variables. I'd like to be able to set the switch class when it's ON so that I can customize that particular class in my SASS like this:

.switchery.is-selected {
  background-color: $brand-main;
}

Is this possible?

Currently, this is how I have it set:

new Switchery(this, { color: '#7ee1c4' });

Notice how now I have the main color specified in two places: once for $brand-main in SASS and once as a 'magic value' in the middle of my javascript code.

Thanks! Viktor

vfonic avatar Sep 29 '15 12:09 vfonic

+1 for this! Would be very useful for branding and for targeting using JS.

JayAdra avatar Nov 05 '15 04:11 JayAdra

Any word on this? Seems like it'd be simple to implement?

JayAdra avatar Apr 02 '16 06:04 JayAdra