2015-10-16 68 views
0

我剛剛從bootstrap starter template複製了代碼,但摺疊菜單不起作用!導航欄崩潰不起作用

這裏是我的代碼:

<?php /* @var $this Controller */ ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ar" lang="ar"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/> 
    <meta name="viewport" content="width=device-width, initial-scale=1"/> 
    <meta name="language" content="ar"/> 
    <meta name="description" content=""/> 
    <meta name="author" content=""/> 

    <link rel="icon" href="../../favicon.ico"> 

    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/js/bootstrap/css/bootstrap.min.css" /> 
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/style.css" /> 

    <title><?php echo CHtml::encode($this->pageTitle); ?></title> 
</head> 

<body> 

    <nav class="navbar navbar-inverse navbar-fixed-top"> 
     <div class="container"> 
     <div class="navbar-header"> 
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-expanded="false" aria-controls="navbar"> 
      <span class="sr-only">Toggle navigation</span> 
      <span class="icon-bar"></span> 
      <span class="icon-bar"></span> 
      <span class="icon-bar"></span> 
      </button> 
      <a class="navbar-brand" href="#">Project name</a> 
     </div> 
     <div class="collapse navbar-collapse"> 
      <ul class="nav navbar-nav"> 
      <li class="active"><a href="#">Home</a></li> 
      <li><a href="#about">About</a></li> 
      <li><a href="#contact">Contact</a></li> 
      </ul> 
     </div><!--/.nav-collapse --> 
     </div> 
    </nav> 

    <div class="container"> 
     <?php echo $content; ?> 
    </div> 

    <div id="footer"> 
     Copyright &copy; <?php echo date('Y'); ?> by My Company.<br/> 
     All Rights Reserved.<br/> 
     <?php echo Yii::powered(); ?> 
    </div> 

    <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-2.1.4.min.js"/> 
    <script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/bootstrap/js/bootstrap.js"/> 

</body> 
</html> 

的JS & css文件加載成功並沒有表現出任何錯誤,所以這裏有什麼問題嗎?

+0

任何機會,你可以得到一個小提琴這個啓動和運行? – fibono

+0

我剛剛測試,它的工作正常。嘗試<!doctype html> –

+0

@LuckyChingi沒有爲我工作 – Mohammad

回答

0

您的script標籤沒有按照您指出的正確格式<script></script>關閉,因此瀏覽器不會爲Bootstrap加載第二個JavaScript文件,導致可摺疊移動菜單無法運行。