Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap JavaScript not working

My toggle javascript buttons worked initially - however I have now found that my toggle button including navbar collapsing toggle and accordion panels. I have included my header and footer. From what I have researched I cant see why it has stopped working. Any help would be appreciated.

Header: WEBSITE TITLE

    <!-- Bootstrap -->
    <link href="style/css/bootstrap.min.css" rel="stylesheet">
    <!--load font awesome-->
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

    <![endif]-->
  </head>

Footer:

 <footer>
<div class="container">
        <p>&copy; Company 2015</p>
      </footer>
    </div> <!-- /container -->
</div>
  </body>

 <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="../../dist/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>
like image 649
user289040 Avatar asked May 12 '15 13:05

user289040


1 Answers

I guess you just copied what was said on the bootstrap side for example:

<script src="../../dist/js/bootstrap.min.js"></script>

If you have the js bootstrap file in one of your folders in the root, you might want to make sure it is the path is right. For example if your html file is in the same directory as your bootstrap.min.js it should be <script src="bootstrap.min.js"></script>.

The quick fix you just did which is simply changing it to
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

Might solve the problem now but it will render your local bootstrap file useless which you can make useful by using a bootstrap cdn fallback. Which is basically loading your local bootstap files if you fail to load remote bootstrap files. This is how to make a bootstrap cdn callback

like image 101
Coding Enthusiast Avatar answered Sep 24 '22 17:09

Coding Enthusiast