2016-03-31 219 views
0

我有以下代码来创建一个切换按钮如何使用Bootstrap切换插件创建切换按钮?

<input type="checkbox" checked data-toggle="toggle"> 

我使用这些库从http://www.bootstraptoggle.com/#usage

<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet"> 
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script> 

,但它只是显示为一个普通的复选框。我如何让它看起来很花哨?

这里是为了什么,我这么远的链接 - http://jsbin.com/bocawucili/edit?html,output

回答

0

它归结为你的标签的顺序,jQuery的需要始终是之前任何需要它。

<script src="//code.jquery.com/jquery-1.10.2.js"></script> 
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> 
    <link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet"> 
    <script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
+0

谢谢! 工程就像一个魅力:) –