我有以下代码来创建一个切换按钮
<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
最佳答案
它归结为你的标签的顺序,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>
关于javascript - 如何使用 Bootstrap Toggle 插件创建切换按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36340044/