Switch.less 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // text
  2. @prefixCls: zk-switch;
  3. // color
  4. @border: #dddee1;
  5. @hoverBorder: #bcbcbc;
  6. @blue: #2d8cf0;
  7. .@{prefixCls} {
  8. display: inline-block;
  9. width: 60px;
  10. height: 24px;
  11. line-height: 22px;
  12. border-radius: 24px;
  13. vertical-align: middle;
  14. border: 1px solid #ccc;
  15. background-color: #ccc;
  16. position: relative;
  17. cursor: pointer;
  18. -webkit-user-select: none;
  19. -moz-user-select: none;
  20. -ms-user-select: none;
  21. user-select: none;
  22. transition: all .2s ease-in-out;
  23. &::after {
  24. content: "";
  25. width: 20px;
  26. height: 20px;
  27. border-radius: 20px;
  28. background-color: #fff;
  29. position: absolute;
  30. left: 1px;
  31. top: 1px;
  32. cursor: pointer;
  33. transition: left .2s ease-in-out,width .2s ease-in-out;
  34. }
  35. &:active::after {
  36. width: 32px;
  37. }
  38. }
  39. .@{prefixCls}__inner {
  40. color: #fff;
  41. font-size: 12px;
  42. position: absolute;
  43. left: 25px;
  44. }
  45. .@{prefixCls}--checked {
  46. border-color: #2d8cf0;
  47. background-color: #2d8cf0;
  48. &::after {
  49. left: 37px;
  50. }
  51. &:active::after {
  52. left: 25px;
  53. }
  54. .@{prefixCls}__inner {
  55. left: 8px;
  56. }
  57. }
  58. .@{prefixCls}--disabled {
  59. cursor: not-allowed;
  60. background: #f3f3f3;
  61. border-color: #f3f3f3;
  62. &::after {
  63. background: #ccc;
  64. cursor: not-allowed;
  65. }
  66. .@{prefixCls}__inner {
  67. color: #ccc;
  68. }
  69. }