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



这是我的代码-

<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>

脚本-

$(document).ready(function() {
        $('#normal-toggle-button').toggleButtons();
    });

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

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

在此处办理入住手续-Fiddle

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>

类事务

您仍然将类设置为"切换按钮",将其更改为"切换"

这是你最新的小提琴:http://jsfiddle.net/WvRZw/10/

 <div id="normal-toggle-button" class="toggle-button"....

更改为

  <div id="normal-toggle-button" class="switch" ....

css/javascript包括

您还需要包含引导程序javascript和css(请参阅参考资料部分)(还涉及包括javascript和css:如何获取引导程序按钮以显示活动状态?)

最新更新