切换按钮(复选框)在Opera mini极限模式下不起作用

时间:2019-11-14 12:42:28

标签: html checkbox opera-mini

我试图在我的网页上添加一个基于复选框的切换按钮,该按钮与Opera mini极限数据保存模式兼容。现在,单击按钮后,按钮不会更改其状态。

代码源:https://proto.io/freebies/onoff/ 请注意,当在Opera mini极限模式下打开此源时,该源工作正常。

按钮:

<div class="onoffswitch" style="display:inline-block;align-items: center;">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
    <span class="onoffswitch-inner"></span>
    <span class="onoffswitch-switch"></span>
</label>


这是类定义

.onoffswitch {
    position: relative; width: 90px;
    -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
    display: none;
}
.onoffswitch-label {
    display: block; overflow: hidden; cursor: pointer;
    border: 2px solid #999999; border-radius: 20px;
}
.onoffswitch-inner {
    display: block; width: 200%; margin-left: -100%;
    transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
    display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
    font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
    box-sizing: border-box;
}
.onoffswitch-inner:before {
    content: "ON";
    padding-left: 11px;
    background-color: #34A7C1; color: #FFFFFF;
}
.onoffswitch-inner:after {
    content: "OFF";
    padding-right: 11px;
    background-color: #EEEEEE; color: #999999;
    text-align: right;
}
.onoffswitch-switch {
    display: block; width: 18px; margin: 6px;
    background: #FFFFFF;
    position: absolute; top: 0; bottom: 0;
    right: 56px;
    border: 2px solid #999999; border-radius: 20px;
    transition: all 0.3s ease-in 0s; 
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
    margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
    right: 0px; 
}

我认为也许 onoffswitch-switch 样式类的transition属性可能与OBML不兼容,但即使删除它也无济于事。您能告诉我需要做些什么更改才能开始工作,或者可以使用其他任何适用于Opera Mini Extreme模式的切换按钮。

0 个答案:

没有答案