我的HTML是:
<!-- Rectangular switch --> <label class="switch"> <input type="checkBox"> <div class="slider"></div> </label> <!-- Rounded switch --> <label class="switch"> <input type="checkBox"> <div class="slider round"></div> </label>
我的css是:
<style type="text/css"> /* The switch - the Box around the slider */ .switch { position: relative; display: inline-block; width: 60px; height: 34px; } /* Hide default HTML checkBox */ .switch input {display:none;} /* The slider */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; BACkground-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; BACkground-color: white; -webkit-transition: .4s; transition: .4s; } input:checked + .slider { BACkground-color: #2196F3; } input:focus + .slider { Box-shadow: 0 0 1px #2196F3; } input:checked + .slider:before { -webkit-transform: translateX(26pX); -ms-transform: translateX(26pX); transform: translateX(26pX); } /* Rounded sliders */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; } </style>
另外我想打开“购买”默认按钮
以上是大佬教程为你收集整理的jquery – 如何只启用一个开关按钮全部内容,希望文章能够帮你解决jquery – 如何只启用一个开关按钮所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。