2017-06-13 90 views
0

Bootstrap導航欄不顯示列表項並且切換按鈕不起作用。Bootstrap Navbar不顯示列表項

<nav class="navbar navbar navbar-default fixed-top navbar-light bg-faded "> 
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> 
    <span class="navbar-toggler-icon"></span> 
    </button> 
    <a class="navbar-brand" href="#"><img src="https://image.ibb.co/fF1j0v/anchor.png" width="30" height="30" class="d-inline-block align-top" alt=""> ShivaWorks</a> 
    <div class="collapse navbar-collapse" id="navbarSupportedContent"> 
    <ul class="navbar-nav mr-auto"> 
     <li class="nav-item active"> 
     <a class="nav-link" href="#about">About<span class="sr-only">(current)</span></a> 
     </li> 
     <li class="nav-item"> 
     <a class="nav-link" href="#portfolio">Portfolio</a> 
     </li> 
     <li class="nav-item"> 
     <a class="nav-link" href="#contact">Contact</a> 
     </li> 
    </ul> 
    </div> 
</nav> 

我錯過了什麼嗎?請幫忙。

+0

提供的jsfiddle。 –

+0

https://codepen.io/monsieurshiva/pen/YQWxqw – KopMaverick

+0

這是因爲你沒有包含Javascript文件。 –

回答

1

您的代碼中沒有使用bootstrap.jsjquery.js。在代碼的末尾

使用前</html>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>

+0

非常感謝!問題解決了 – KopMaverick