Bootstrap Switch无法切换

时间:2014-02-02 19:15:18

标签: twitter-bootstrap

我正在尝试一个非常简单的直接集成Bootstrap Switch(http://www.bootstrap-switch.org/),但由于某种原因,交换机不会切换。系统没有给出任何错误,当我点击它时它不会改变状态(在Windows 8 - Chrome上试过)。

我的测试代码如下(我直接从他们的网站使用JS和CSS来防止出现任何错误):

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Some title</title>

  <!-- Bootstrap core CSS -->
  <link href="http://www.bootstrap-switch.org/docs/vendor/bootstrap.min.css" rel="stylesheet">
  <link href="http://www.bootstrap-switch.org/build/css/bootstrap3/bootstrap-switch.min.css" rel="stylesheet">


  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  <![endif]-->
</head>

<body>
  <div class="container">


    <div class="has-switch switch-animate switch-on" tabindex="0"><div><span class="switch-left">ON</span><label for="switch-change">&nbsp;</label><span class="switch-right">OFF</span><input type="checkbox" id="switch-change" checked=""></div></div>

 </div> <!-- /container -->

  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
  <script src="http://www.bootstrap-switch.org/docs/vendor/jquery.js"></script>
  <!-- Include all compiled plugins (below), or include individual files as needed -->
  <script src="http://www.bootstrap-switch.org/docs/vendor/bootstrap.min.js"></script>
  <script src="http://www.bootstrap-switch.org/build/js/bootstrap-switch.min.js"></script>
</body>
</html>

关于我做错的任何想法?

1 个答案:

答案 0 :(得分:0)

似乎我还必须包含他们正在使用的index.js。之后一切正常。