onoffswitch.css 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .mg-wrapper .onoffswitch {
  2. position: relative; width: 120px;
  3. -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
  4. }
  5. .mg-wrapper .onoffswitch-checkbox {
  6. display: none;
  7. }
  8. .mg-wrapper .onoffswitch-label {
  9. display: block; overflow: hidden; cursor: pointer;
  10. border: 1px solid #666666; border-radius: 5px;
  11. }
  12. .mg-wrapper .onoffswitch-inner {
  13. display: block; width: 200%; margin-left: -100%;
  14. -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s;
  15. -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s;
  16. }
  17. .mg-wrapper .onoffswitch-inner:before, .onoffswitch-inner:after {
  18. display: block; float: left; width: 50%; height: 24px; padding: 0; line-height: 24px;
  19. font-size: 12px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
  20. -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
  21. }
  22. .mg-wrapper .onoffswitch-inner:before {
  23. content: attr(data-before);
  24. padding-left: 10px;
  25. background-color: #5CB85C; color: #FFFFFF;
  26. }
  27. .mg-wrapper .onoffswitch-inner:after {
  28. content: attr(data-after);
  29. padding-right: 10px;
  30. background-color: #F8F8F8; color: #666666;
  31. text-align: right;
  32. }
  33. .mg-wrapper .onoffswitch-switch {
  34. display: block; width: 35px; margin: 0px; height: 26px;
  35. background: #FFFFFF;
  36. border: 1px solid #666666; border-radius: 5px;
  37. position: absolute; top: 0; bottom: 0; right: 81px;
  38. -moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s;
  39. -o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s;
  40. background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
  41. background-image: -webkit-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
  42. background-image: -o-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
  43. background-image: linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
  44. }
  45. .mg-wrapper .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
  46. margin-left: 0;
  47. }
  48. .mg-wrapper .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
  49. right: 0px;
  50. }