我创建了像单选按钮这样的ios,它可以在桌面上正常工作(即使在IE8上,也可以在ie7.js上运行),但在IOS设备上却没有(我已在iPhone 4,iPhone 5s和iPad mini上测试过)。 / p>
HTML
<span class="inp-text ios-like">
<input type="checkbox" id="checkbox" name="" checked="checked">
<label for="checkbox">
<span class="button"></span>
<span class="bg"></span>
</label>
</span>
CSS
.ios-like {
height: 35px;
width: 70px;
position: relative; }
.ios-like label {
position: absolute;
top: 0;
left: 0;
height: 35px;
width: 70px;
padding: 0; }
.ios-like label .bg {
position: absolute;
top: 0;
left: 0;
height: 35px;
width: 70px;
transition: 0.3s all;
border-radius: 3px;
background: #999;
border: 1px solid #666; }
.ios-like label .button {
position: absolute;
z-index: 6;
width: 26px;
height: 24px;
background: #F7F7F9;
top: 6px;
left: 8px;
border-radius: 4px;
transition: 0.3s all;
box-shadow: 0 1px 0px 0px #666; }
.ios-like label .button:before, .ios-like label .button:after {
content: "";
display: block;
width: 10px;
height: 1px;
background: #fff;
border-top: 1px solid #e6e6e6;
position: absolute;
left: 50%;
top: 50%;
margin-left: -5px;
z-index: 7; }
.ios-like label .button:before {
margin-top: -3px; }
.ios-like label .button:after {
margin-top: 3px; }
.ios-like label:before, .ios-like label:after {
font-family: 'icons';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 16px;
font-size: 1.6rem;
background-color: transparent;
margin-top: -8px;
position: absolute;
top: 50%;
z-index: 5;
color: #fff; }
.ios-like label:before {
content: "\e616";
right: 10px; }
.ios-like label:after {
content: "\e617";
left: 10px; }
.ios-like input[type=checkbox] {
position: absolute;
opacity: 0;
filter: alpha(opacity=0);
zoom: 1; }
.ios-like input[type=checkbox]:checked + label .bg {
background: #47aa42;
border-color: #378C33; }
.ios-like input[type=checkbox]:checked + label .button {
left: 38px;
box-shadow: 0 1px 0px 0px #399735; }
有时它有时不工作(基本上在第一次“点击”它没关系,但反复触摸它没有反应)。
知道为什么吗?在过去的一些js插件中,这些滞后的东西正在转变。我试图将其关闭,但结果相同。