Bootstrap Dropdown not working - Dropdown doesn

2019-08-20 03:17发布

问题:

I'm trying to use Twitters bootstrap dropdown, but when I click on the dropdown toggler (Information), the dropdown doesnt activate and nothing happens.

header.php:

<?php
include('minequery.class.php');
?>
<html>
<head>      
<LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>    
<LINK REL=StyleSheet HREF="css/bootstrap.css" TYPE="text/css" MEDIA=screen>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/  
bootstrap-dropdown.js"></script>
<script src="js/bootstrap.js" type="text/javascript"></script> 
</head>    
<body>        
<div class="header">            
<a href=""><div id="logo"></div><div id="banner"></div></a>            
<div class="navbar navbar-inverse">
  <div class="navbar-inner">
<ul class="nav">
  <li class="active"><a href="index.php">Home</a></li>
  <li><a href="about.php">About</a></li>
  <li><a href="server.php">Server</a></li>
  <li><a href="http://forums.interitumcraft.com">Forums</a></li>
  <li><a href="downloads.php">Downloads</a></li>
  <li><a href="http://donate.interitumcraft.com">Donate</a></li>
  <li><a href="vote.php">Vote</a></li>
  <li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">
  Information
  <b class="caret"></b>
  </a>
  <ul class="dropdown-menu">
    <li><a href="#">Rules</a></li>
    <li><a href="#">Guilds</a></li>
    <li><a href="#">Staff</a></li>
  </ul>
  </li>
 </ul>
  </div>
</div>       
</div>        

index.php

<?php include('header.php'); ?>
<html><head><title>InteritumCraft | Minecraft Guild Server</title></head></html>
<div class="main">            
<h2>Home</h2>            
<div id="content">                
<h3>Announcements</h3> 
<?php
 $con = mysql_connect("localhost","interitu_forums","");
 if (!$con)
   {    
   die('Could not connect: ' . mysql_error());
   }

 mysql_select_db("interitu_forums", $con);

 $result = mysql_query("SELECT * FROM mybb_posts WHERE fid='4' LIMIT 5");

 while($row = mysql_fetch_array($result))
   {
?>
<h4>
<?php echo $row['subject']; ?></h4>
<?php echo(substr($row['message'], 0,500)) . '…'; ?>
<?php
echo $text; ?>
<br />
<i><a style="float: right;" href="http://forums.interitumcraft.com/thread-<?php 
echo $row['tid']; ?>.html">Read On</a></i>      
<?php
}

 mysql_close($con);
 ?>
</div>            
<?php include('sidebar.php'); ?>

Sidebar:

 </div>
 </div>
 <br /><br />
 <div id="footer">
 <p>© Copyright Lewes & Mathias / InteritumCraft 2012. All rights reserved</p>  
 </body>
 </html>

I am using the latest bootstrap with all the features and components. Why wont the dropdown toggle?div id=

回答1:

You have no need to add directly bootstrap-dropdown.js, because the js file bootstrap.js contain already all jQuery plugins used by bootstrap.

On Chromium 23, use both scripts disable feature without display any error message.



回答2:

You have to refer the Jquery before you refer the bootstrap js.