javascript - 如何停止显示复选框,所以它只是 slider

标签 javascript jquery html css checkbox

我在这里使用 slider 3:

http://cssdeck.com/labs/css-checkbox-styles

它是“开/关” slider ,我复制了 HTML 和 CSS。一切正常,但在我的网页上,“复选框”和“开/关” slider 仍然可见,请参阅:

http://i.imgur.com/n7Pbitj.jpg

我使用的 CSS 是:

/* SLIDE THREE */
.slideThree {
    width: 80px;
    height: 26px;
    background: #333;
    margin: 20px auto;

    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
    position: relative;

    -webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
    -moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
    box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
}

.slideThree:after {
    content: 'OFF';
    font: 12px/26px Arial, sans-serif;
    color: #000;
    position: absolute;
    right: 10px;
    z-index: 0;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}

.slideThree:before {
    content: 'ON';
    font: 12px/26px Arial, sans-serif;
    color: #00bf00;
    position: absolute;
    left: 10px;
    z-index: 0;
    font-weight: bold;
}

.slideThree label {
    display: block;
    width: 34px;
    height: 20px;

    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;

    -webkit-transition: all .4s ease;
    -moz-transition: all .4s ease;
    -o-transition: all .4s ease;
    -ms-transition: all .4s ease;
    transition: all .4s ease;
    cursor: pointer;
    position: absolute;
    top: 3px;
    left: 3px;
    z-index: 1;

    -webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
    -moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
    box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
    background: #fcfff4;

    background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}

.slideThree input[type=checkbox]:checked + label {
    left: 43px;
}

我使用的 HTML 是:

<!-- Slide THREE -->
<div class="slideThree">    
    <input type="checkbox" value="None" id="slideThree" name="check" />
    <label for="slideThree"></label>
</div>

感谢您的帮助。

谢谢

最佳答案

<style> .slideThree input[type=checkbox] {
  visibility: hidden;
}
</style>

关于javascript - 如何停止显示复选框,所以它只是 slider ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30664835/

相关文章:

php - 简单的 HTML DOM 找不到 DIV

javascript - 变异观察者不起作用

jquery - 使用 Bootstrap 在某些设备上内联显示列表

javascript - 仅使用 html 和 javascript/jquery 的基于组件的设计的最佳实践

css - 以模态形式验证

javascript - 反转有序列表的编号顺序

javascript - Angular js $scope.apply 函数不更新模板

javascript - 防止 Esc 键退出网站上的全屏应用程序模式

javascript - 在 AJAX 请求后,Chrome 在 HTTP 205 响应上下载重新加载的页面

图像上的 Javascript 动画