Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title></title>
  5. <style type="text/css">
  6.  
  7. .switch {
  8. width: auto;
  9. display: inline-block;
  10. position: relative;
  11. user-select: none;
  12. cursor: pointer;
  13. }
  14.  
  15. .switch__label {
  16. width: 50%;
  17. display: inline-block;
  18. font-size: 12px;
  19. padding: 5px 10px;
  20. box-sizing: border-box;
  21. }
  22.  
  23. .switch__labels {
  24. border-radius: 20px;
  25. overflow: hidden;
  26. background: #ccc;
  27. font-size: 0;
  28. }
  29.  
  30. .switch__control {
  31. position: absolute;
  32. visibility: hidden;
  33. }
  34.  
  35. .switch__button {
  36. width: 35px;
  37. height: 35px;
  38. border-radius: 50%;
  39. display: block;
  40. background: #000;
  41. position: absolute;
  42. right: 0;
  43. top: 50%;
  44. transform: translate(0, -50%);
  45. transition: transform 200ms;
  46. }
  47.  
  48. .switch__option {
  49. position: absolute;
  50. color: #fff;
  51. top: 50%;
  52. left: 50%;
  53. transform: translate(-50%, -50%);
  54. opacity: 0;
  55. }
  56.  
  57. .switch__option:last-child {
  58. opacity: 1;
  59. }
  60.  
  61. .switch__control:checked + .switch__button {
  62. transform: translate(-100%, -50%);
  63. }
  64.  
  65. .switch__control:checked + .switch__button .switch__option {
  66. opacity: 1;
  67. }
  68.  
  69. .switch__control:checked + .switch__button .switch__option:last-child {
  70. opacity: 0;
  71. }
  72.  
  73. </style>
  74. </head>
  75. <body>
  76.  
  77.  
  78. <label class="switch" for="switch-control">
  79. <input type="checkbox" id="switch-control" class="switch__control" />
  80. <div class="switch__button">
  81. <div class="switch__option">FR</div>
  82. <div class="switch__option">EN</div>
  83. </div>
  84. <div class="switch__labels">
  85. <div class="switch__label">FR</div>
  86. <div class="switch__label">EN</div>
  87. </div>
  88. </label>
  89.  
  90. <script src="jquery.js"></script>
  91. <script type="text/javascript">
  92. $(function(){
  93.  
  94. });
  95. </script>
  96. </body>
  97. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement