作者:手机用户2602921303_852 | 来源:互联网 | 2023-09-23 19:58
如图 如何实现打开强效杀菌的switch开关的时候 自定义跟智能杀菌的两个swtich从开的状态重新回到关闭的状态代码如下swithch样式12345678910111213141516171819
如图 如何实现打开强效杀菌的switch开关的时候 自定义跟智能杀菌的两个swtich从开的状态重新回到关闭的状态
代码如下
swithch样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
| .LabelSwitch {
position: relative;
/*overflow: hidden;*/
display: inline-block;
vertical-align: middle;
width: 52px;
height: 32px;
cursor: pointer;
border-radius: 16px;
-ms-flex-item-align: center;
-webkit-align-self: center;
align-self: center
}
.LabelSwitch input[type=checkbox] {
display: none
}
.LabelSwitch .checkbox,.LabelSwitch .checkbox:before,.LabelSwitch .checkbox:after {
-webkit-transition-duration: .3s;
transition-duration: .3s
}
.LabelSwitch .checkbox {
position: relative;
width: 52px;
height: 32px;
display: inline-block;
/*overflow:hidden;*/
background: #e5e5e5;
border: 0;
cursor: pointer;
z-index: 0;
border-radius: 16px;
-webkit-appearance: none;
appearance: none
}
.LabelSwitch .checkbox:before {
position: absolute;
left: 2px;
top: 2px;
width: 48px;
height: 28px;
background: #fff;
content: "";
z-index: 1;
border-radius: 16px;
-webkit-transform: scale(1);
transform: scale(1)
}
.LabelSwitch .checkbox:after {
position: absolute;
left: 2px;
top: 2px;
width: 28px;
height: 28px;
background: #fff;
content: "";
z-index: 4;
border-radius: 28px;
box-shadow: 0 2px 5px rgba(0,0,0,.4);
-webkit-transform: translateX(0);
transform: translateX(0)
}
.LabelSwitch:active .checkbox:after {
width: 36px
}
.LabelSwitch:active input[type=checkbox]:checked+.checkbox:after {
left: -6px
}
.LabelSwitch input[type=checkbox]:checked+.checkbox {
background: #ffb144;
}
.LabelSwitch input[type=checkbox]:checked+.checkbox:before {
-webkit-transform: scale(0);
transform: scale(0)
}
.LabelSwitch input[type=checkbox]:checked+.checkbox:after {
-webkit-transform: translateX(20px);
transform: translateX(20px)
}
.LabelSwitchText,.LabelSwitchText .checkbox {
width: 74px;
margin-left: 4rem;
}
.LabelSwitchText .checkbox:before {
width: 70px
}
.LabelSwitchText input[type=checkbox]:checked+.checkbox:after {
-webkit-transform: translateX(42px);
transform: translateX(42px)
}
.LabelSwitchText .checkbox span {
position: absolute;
width: 100%;
height: 100%;
z-index: 3;
text-transform: uppercase
}
.LabelSwitchText .checkbox span:before,.LabelSwitchText .checkbox span:after {
position: absolute;
top: 2px;
height: 28px;
line-height: 28px;
z-index: 1;
-webkit-transform: translateX(0);
transform: translateX(0);
-webkit-transition-duration: .1s;
transition-duration: .1s
}
.LabelSwitchText .checkbox span:before {
right: 12px;
content: "Off";
-webkit-transform: scale(1);
transform: scale(1)
}
.LabelSwitchText .checkbox span:after {
left: 14px;
content: "ON";
color: #fff;
-webkit-transform: scale(0);
transform: scale(0)
}
.LabelSwitchText input[type=checkbox]:checked+.checkbox span:before {
-webkit-transform: scale(0);
transform: scale(0)
}
.LabelSwitchText input[type=checkbox]:checked+.checkbox span:after {
-webkit-transform: scale(1);
transform: scale(1)
} |
html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| |
不知道要用JS操作那几个样式??