Bootstrap Dropdown无法正常工作 - Dropdown不会切换

时间:2012-11-11 16:27:40

标签: php javascript jquery drop-down-menu twitter-bootstrap

我正在尝试使用Twitters bootstrap下拉列表,但是当我点击下拉切换器(信息)时,下拉列表不会激活,也没有任何反应。

的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'); ?>

边栏:

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

我正在使用具有所有功能和组件的最新引导程序。为什么不下拉切换?div id =

2 个答案:

答案 0 :(得分:1)

您无需直接添加bootstrap-dropdown.js,因为js文件bootstrap.js已包含bootstrap使用的所有jQuery插件。

在Chromium 23上,使用两个脚本禁用功能而不显示任何错误消息。

答案 1 :(得分:0)

在引用bootstrap js之前,你必须引用Jquery。