index.acss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. .main .cus-switch {
  2. display: flex;
  3. align-items: center;
  4. font-size: calc(20vmax / 12.80);
  5. }
  6. .main .cus-switch .switch-main {
  7. position: relative;
  8. width: calc(58vmax / 12.80);
  9. height: calc(34vmax / 12.80);
  10. background: #fff;
  11. border: calc(1vmax / 12.80) solid #ccc;
  12. margin-right: calc(20vmax / 12.80);
  13. transition: all 0.3s ease;
  14. }
  15. .main .cus-switch .capsule {
  16. border-radius: calc(36vmax / 12.80);
  17. }
  18. .main .cus-switch .square {
  19. border-radius: calc(6vmax / 12.80);
  20. width: calc(58vmax / 12.80);
  21. }
  22. .main .cus-switch .switch-main::after {
  23. content: "";
  24. position: absolute;
  25. left: calc(3vmax / 12.80);
  26. top: calc(3vmax / 12.80);
  27. width: calc(28vmax / 12.80);
  28. height: calc(28vmax / 12.80);
  29. background: #fff;
  30. box-shadow: 0 0 0 calc(1vmax / 12.80) #ccc;
  31. transition: all 0.3s ease;
  32. box-sizing: border-box;
  33. }
  34. .main .cus-switch .capsule::after {
  35. border-radius: 50%;
  36. }
  37. .main .cus-switch .square::after {
  38. border-radius: calc(6vmax / 12.80);
  39. }
  40. .main .cus-switch .checked {
  41. background: rgba(61, 115, 255, 1);
  42. border-color: rgba(61, 115, 255, 1);
  43. }
  44. .main .cus-switch .checked::after{
  45. box-shadow: none;
  46. }
  47. .main .cus-switch .capsule.checked::after {
  48. transform: translateX(calc(58vmax / 12.80 - 34vmax / 12.80));
  49. }
  50. .main .cus-switch .square.checked::after {
  51. transform: translateX(calc(58vmax / 12.80 - 34vmax / 12.80));
  52. }
  53. .main .cus-switch .disabled {
  54. opacity: 0.4;
  55. }
  56. /*竖屏样式*/
  57. .portrait-main .cus-switch {
  58. display: flex;
  59. align-items: center;
  60. font-size: calc(20vmin / 12.80);
  61. /*padding: calc(10vmax / 12.80);*/
  62. /*background: red;*/
  63. }
  64. .portrait-main .cus-switch .switch-main {
  65. position: relative;
  66. width: calc(70vmin / 12.80);
  67. height: calc(40vmin / 12.80);
  68. background: #fff;
  69. border: calc(1vmin / 12.80) solid #ccc;
  70. margin-right: calc(20vmin / 12.80);
  71. transition: all 0.3s ease;
  72. }
  73. .portrait-main .cus-switch .capsule {
  74. border-radius: calc(36vmin / 12.80);
  75. }
  76. .portrait-main .cus-switch .square {
  77. border-radius: calc(6vmin / 12.80);
  78. width: calc(70vmin / 12.80);
  79. }
  80. .portrait-main .cus-switch .switch-main::after {
  81. content: "";
  82. position: absolute;
  83. left: calc(6vmin / 12.80);
  84. top: calc(6vmin / 12.80);
  85. width: calc(28vmin / 12.80);
  86. height: calc(28vmin / 12.80);
  87. background: #fff;
  88. box-shadow: 0 0 0 calc(1vmin / 12.80) #ccc;
  89. transition: all 0.3s ease;
  90. box-sizing: border-box;
  91. }
  92. .portrait-main .cus-switch .capsule::after {
  93. border-radius: 50%;
  94. }
  95. .portrait-main .cus-switch .square::after {
  96. border-radius: calc(6vmin / 12.80);
  97. }
  98. .portrait-main .cus-switch .checked {
  99. background: rgba(61, 115, 255, 1);
  100. border-color: rgba(61, 115, 255, 1);
  101. }
  102. .portrait-main .cus-switch .checked::after{
  103. box-shadow: none;
  104. }
  105. .portrait-main .cus-switch .capsule.checked::after {
  106. transform: translateX(calc(70vmin / 12.80 - 40vmin / 12.80));
  107. }
  108. .portrait-main .cus-switch .square.checked::after {
  109. transform: translateX(calc(70vmin / 12.80 - 40vmin / 12.80));
  110. }
  111. .portrait-main .cus-switch .disabled {
  112. opacity: 0.4;
  113. }