开/关:开关按钮引导程序

Man*_*noz 7 javascript jquery uiswitch twitter-bootstrap

这是我的代码 -

<div id="normal-toggle-button" class="toggle-button" style="width: 100px; height: 25px;">
            <div style="left: 0px; width: 150px;"><input type="checkbox" checked="checked"><span class="labelLeft" style="width: 50px; height: 25px; line-height: 25px;">ON</span><label for="" style="width: 50px; height: 25px;"></label><span class="labelRight" style="width: 50px; height: 25px; line-height: 25px;">OFF </span></div>
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

脚本-

$(document).ready(function() {
        $('#normal-toggle-button').toggleButtons();
    });
Run Code Online (Sandbox Code Playgroud)

我想在此页面上给出一个基本按钮 - 切换按钮

我做得很好.但我还是错过了一些东西.

在这里办理入住手续 - 小提琴

Ste*_*ing 10

最简单的使用bootstrapSwitch

演示

<link href="bootstrap-switch.css" rel="stylesheet">
<script src="jquery.js"></script>
<script src="bootstrap-switch.js"></script>

<input type="checkbox">
<script>
  $('input:checkbox').bootstrapSwitch();
</script>
Run Code Online (Sandbox Code Playgroud)

  • 它似乎不再起作用了.也许最新版本的bootstrap打破了? (2认同)