39 views
CSSAdd prefixes
1/* The switch - the box around the slider */ 2.switch { 3 position: relative; 4 display: flex; 5 align-items: center; 6 justify-content: center; 7 width: 3.8em; 8 height: 3.8em; 9} 10 11.torch { 12 margin-top: 0.9em; 13 margin-left: 0.95em; 14 width: 30px; 15 height: 30px; 16 transform: rotate(-45deg); 17} 18 19.slider .b { 20 position: relative; 21 top: -3.3em; 22 transform: rotate(270deg); 23} 24 25.slider .bling_85 { 26 stroke: #fff; 27 stroke-width: 2.5; 28 stroke-linecap: round; 29 stroke-dasharray: 3; 30 stroke-dashoffset: 15; 31 transition: all 0.3s ease; 32} 33 34/* Hide default HTML checkbox */ 35.switch input { 36 opacity: 0; 37 width: 0; 38 height: 0; 39} 40 41/* The slider */ 42.slider { 43 position: absolute; 44 cursor: pointer; 45 top: 0; 46 left: 0; 47 right: 0; 48 bottom: 0; 49 transition: .4s; 50 border-radius: 50%; 51 background-color: rgba(116, 115, 115, 0.2); 52 backdrop-filter: blur(5px); 53 -webkit-backdrop-filter: blur(5px); 54 border: 1px solid rgba(255, 255, 255, 0.3); 55} 56 57.chk_85:checked + .slider { 58 animation: tap 0.3s linear forwards; 59} 60 61.chk_85:checked + .slider .bling_85 { 62 animation: bling_8561328 0.3s linear forwards; 63 animation-delay: 0.2s; 64} 65 66.chk_85:checked + .slider { 67 background-color: #FFA133; 68} 69 70.chk_85:focus + .slider { 71 box-shadow: 0 0 1px #FFA133; 72} 73 74@keyframes bling_8561328 { 75 50% { 76 stroke-dasharray: 3; 77 stroke-dashoffset: 12; 78 } 79 80 100% { 81 stroke-dasharray: 3; 82 stroke-dashoffset: 9; 83 } 84} 85 86@keyframes tap { 87 50% { 88 scale: 0.9; 89 } 90 91 100% { 92 scale: 1; 93 } 94}
HTML
1<label class="switch"> 2 <input class="chk_85" type="checkbox"> 3 <span class="slider"> 4 <svg viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" class="torch"> 5 <path d="M 63.85,54.65 Q 62.77,54.13 61.88,53.31 Q 54.13,46.12 46.31,37.69 Q 43.88,35.06 44.29,31.53 Q 44.51,29.56 46.54,25.87 Q 56.15,8.39 59.06,3.56 Q 60.59,1.03 63.83,2.41 Q 67.73,4.07 71.11,6.55 Q 72.85,7.82 77.51,11.86 Q 89.11,21.92 96.94,34.06 Q 100.09,38.95 95.24,41.73 Q 83.77,48.31 72.16,54.64 Q 68.24,56.77 63.85,54.65 Z" fill="#ffffff"></path> 6 <path d="M 14.03,66.29 Q 27.40,51.66 40.57,37.33 A 0.54,0.54 52.1 0 1 41.44,37.44 Q 43.25,40.72 45.58,43.04 Q 47.66,45.11 47.71,45.17 Q 54.67,52.58 62.60,58.93 A 0.44,0.43 43.0 0 1 62.63,59.59 Q 42.87,77.87 22.77,95.78 Q 20.75,97.58 19.20,97.93 Q 16.72,98.49 14.81,96.94 Q 6.88,90.47 2.81,84.94 Q 1.47,83.11 2.03,80.84 Q 2.37,79.43 4.04,77.51 Q 8.97,71.84 14.03,66.29 ZM 42.9269,57.1766 A 3.76 3.76 0.0 0 0 37.6102,57.0930 L 33.1721,61.3938 A 3.76 3.76 0.0 0 0 33.0886,66.7106 L 33.3531,66.9834 A 3.76 3.76 0.0 0 0 38.6698,67.0670 L 43.1079,62.7662 A 3.76 3.76 0.0 0 0 43.1914,57.4494 L 42.9269,57.1766 Z" fill="#ffffff"></path> 7 </svg> 8 <svg class="b" width="100%" height="50%" version="1.1" xmlns="http://www.w3.org/2000/svg"> 9 <path d="M29 20L31 22" class="bling_85"></path> 10 <path d="M31.5 15H34.5" class="bling_85"></path> 11 <path d="M29 10L31 8" class="bling_85"></path> 12 </svg> 13 </span> 14</label>