Sha256: a931f3f2a4a1505a1af039d6d31876aba04c7cd5e5331ac44a4fec8d055a711a

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

.switch {
  $switch-width: 52px;
  $switch-padding: 2px;
  $switch-height: 32px;
  $knob-size: $switch-height - ($switch-padding * 2);
  $knob-width: $knob-size;

  cursor: pointer;
  display: inline-block;
  position: relative;

  input {
    display: none;

    + .checkbox {
      @include size($switch-width, $switch-height);
      border: 1px solid #000;
      cursor: pointer;
      position: relative;
      width: $switch-width;
      z-index: 0;

      &::before {
        @include position(absolute, $switch-padding 0 0 $switch-padding);
        content: "";
        width: $switch-width - ($switch-padding * 2);
        z-index: 1;
      }

      &::after {
        @include position(absolute, 1px 0 0 1px);
        @include size($knob-size);
        background-color: #000;
        content: "";
        transition: all 0.3s ease;
        z-index: 2;
      }
    }

    &:checked {
      + .checkbox {
        background-color: #aaa;

        &::after {
          left: $switch-width - $knob-width - ($switch-padding * 2) + 1px;
        }
      }
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
refills-0.2.0 source/stylesheets/refills/unstyled/_switch.scss