toggles.scss 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // Toggle styles (to be used with toggles.js)
  3. // --------------------------------------------------
  4. .toggle {
  5. position: relative;
  6. display: block;
  7. width: 74px;
  8. height: 30px;
  9. background-color: #fff;
  10. border: 2px solid #ddd;
  11. border-radius: 20px;
  12. @include transition-property(background-color, border);
  13. @include transition-duration(.2s);
  14. // Sliding handle
  15. .toggle-handle {
  16. position: absolute;
  17. top: -1px;
  18. left: -1px;
  19. z-index: 2;
  20. width: 28px;
  21. height: 28px;
  22. background-color: #fff;
  23. border: 1px solid #ddd;
  24. border-radius: 100px;
  25. -webkit-transition-property: -webkit-transform, border, width;
  26. -moz-transition-property: -moz-transform, border, width;
  27. transition-property: transform, border, width;
  28. @include transition-duration(.2s);
  29. }
  30. &:before {
  31. position: absolute;
  32. top: 3px;
  33. right: 11px;
  34. font-size: 13px;
  35. color: #999;
  36. text-transform: uppercase;
  37. content: "Off";
  38. }
  39. // Active state for toggle
  40. &.active {
  41. background-color: $positive-color;
  42. border: 2px solid $positive-color;
  43. .toggle-handle {
  44. border-color: $positive-color;
  45. @include transform(translate3d(44px,0,0));
  46. }
  47. &:before {
  48. right: auto;
  49. left: 15px;
  50. color: #fff;
  51. content: "On";
  52. }
  53. }
  54. // Hide the checkbox
  55. input[type="checkbox"] {
  56. display: none;
  57. }
  58. }