index.wxss 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. .zan-switch {
  2. position: relative;
  3. display: inline-block;
  4. width: 52px;
  5. height: 32px;
  6. vertical-align: middle;
  7. box-sizing: border-box;
  8. border-radius: 16px;
  9. background: #44DB5E;
  10. border: 1px solid #44DB5E;
  11. }
  12. .zan-switch__circle {
  13. position: absolute;
  14. top: 0;
  15. left: 0;
  16. width: 30px;
  17. height: 30px;
  18. display: inline-block;
  19. background: #fff;
  20. border-radius: 15px;
  21. box-sizing: border-box;
  22. box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 3px 1px 0 rgba(0, 0, 0, 0.05), 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 3px 3px 0 rgba(0, 0, 0, 0.05);
  23. transition: transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
  24. z-index: 2;
  25. }
  26. .zan-switch__bg {
  27. position: absolute;
  28. top: -1px;
  29. left: -1px;
  30. width: 52px;
  31. height: 32px;
  32. background: #fff;
  33. border-radius: 26px;
  34. display: inline-block;
  35. border: 1px solid #e5e5e5;
  36. box-sizing: border-box;
  37. transition: transform 0.35s cubic-bezier(0.45, 1, 0.4, 1);
  38. transform: scale(0);
  39. transform-origin: 36px 16px;
  40. }
  41. .zan-switch--on .zan-switch__circle {
  42. transform: translateX(20px);
  43. }
  44. .zan-switch--off .zan-switch__bg {
  45. transform: scale(1);
  46. }
  47. .zan-swtich--disabled {
  48. opacity: 0.4;
  49. }
  50. .zan-switch__loading {
  51. position: absolute;
  52. left: 7px;
  53. top: 7px;
  54. width: 16px;
  55. height: 16px;
  56. background: url(https://img.yzcdn.cn/public_files/2017/02/24/9acec77d91106cd15b8107c4633d9155.png) no-repeat;
  57. background-size: 16px 16px;
  58. animation: zan-switch-loading 0.8s infinite linear;
  59. }
  60. @keyframes zan-switch-loading {
  61. from {
  62. transform: rotate(0);
  63. }
  64. to {
  65. transform: rotate(360deg);
  66. }
  67. }