index.module.scss 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. input {
  2. display: none;
  3. // margin-bottom: 10px;
  4. }
  5. .slider {
  6. position: absolute;
  7. width: 80px;
  8. height: 30px;
  9. bottom: -30px;
  10. margin-bottom: 15px;
  11. box-shadow: 0 2px 5px rgba(18, 80, 105, 0.25), 0 5px 5px rgba(0, 0, 0, 0.22);
  12. z-index: 1;
  13. overflow: hidden;
  14. background-color: #315870;
  15. border-radius: 50px;
  16. cursor: pointer;
  17. transition: all 1.4s;
  18. &:before,
  19. &:after {
  20. content: '';
  21. position: absolute;
  22. bottom: -25px;
  23. left: 5px;
  24. bottom: 5px;
  25. width: 20px;
  26. height: 20px;
  27. background-color: #ffffff;
  28. border-radius: 30px;
  29. }
  30. &:before {
  31. transition: 0.4s;
  32. }
  33. &:after {
  34. transition: 0.5s;
  35. }
  36. }
  37. .wave {
  38. position: absolute;
  39. width: 80px;
  40. height: 30px;
  41. bottom: -30px;
  42. margin-bottom: 15px;
  43. border-radius: 50px;
  44. transition: all 1.4s;
  45. }
  46. input:checked + .slider {
  47. background-color: transparent;
  48. //
  49. &:before,
  50. &:after {
  51. transform: translateX(50px);
  52. }
  53. }
  54. input:checked ~ .wave {
  55. // display: block;
  56. // bottom: -30px;
  57. // margin-bottom: 20px;
  58. background-color: #a5c1d1;
  59. }
  60. @media screen and (max-width: 768px) {
  61. .slider {
  62. position: absolute;
  63. width: 50px;
  64. height: 30px;
  65. bottom: -30px;
  66. &:before,
  67. &:after {
  68. content: '';
  69. position: absolute;
  70. left: 5px;
  71. bottom: 5px;
  72. width: 20px;
  73. height: 20px;
  74. background-color: #ffffff;
  75. border-radius: 30px;
  76. }
  77. }
  78. .wave {
  79. position: absolute;
  80. width: 50px;
  81. height: 30px;
  82. }
  83. input:checked + .slider {
  84. background-color: transparent;
  85. //
  86. &:before,
  87. &:after {
  88. transform: translateX(20px);
  89. }
  90. }
  91. }