2015-10-15 52 views
2

我需要您的帮助和建议,以及我在学习Twitter Bootstrap时遇到的问题。我正在使用来自W3Schools的确切代码来放置可折叠的NavBar。Twitter Bootstrap在使用IP地址时不起作用,但在“localhost”中工作

我使用Eclipse和Apache Tomcat本地服务器。

我看到两个不同的输出具有相同的代码。

一些奇怪的原因,我无法上传图片。当当 “IP地址” 运行在 “localhost”(http://localhost:8080/test.html

网站运行:(

网站(http://my-ip:8080/test.html

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>Bootstrap Case</title> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
</head> 
<body> 
    <nav class="navbar navbar-inverse"> 
     <div class="container-fluid"> 
      <div class="navbar-header"> 
       <button type="button" class="navbar-toggle" data-toggle="collapse" 
        data-target="#myNavbar"> 
        <span class="icon-bar"></span> <span class="icon-bar"></span> <span 
         class="icon-bar"></span> 
       </button> 
       <a class="navbar-brand" href="#">WebSiteName</a> 
      </div> 
      <div class="collapse navbar-collapse" id="myNavbar"> 
       <ul class="nav navbar-nav"> 
        <li class="active"><a href="#">Home</a></li> 
        <li class="dropdown"><a class="dropdown-toggle" 
         data-toggle="dropdown" href="#">Page 1 <span class="caret"></span></a> 
         <ul class="dropdown-menu"> 
          <li><a href="#">Page 1-1</a></li> 
          <li><a href="#">Page 1-2</a></li> 
          <li><a href="#">Page 1-3</a></li> 
         </ul></li> 
        <li><a href="#">Page 2</a></li> 
        <li><a href="#">Page 3</a></li> 
       </ul> 
       <ul class="nav navbar-nav navbar-right"> 
        <li><a href="#"><span class="glyphicon glyphicon-user"></span> 
          Sign Up</a></li> 
        <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> 
          Login</a></li> 
       </ul> 
      </div> 
     </div> 
    </nav> 

    <div class="container"> 
     <h3>Collapsible Navbar</h3> 
     <p>In this example, the navigation bar is hidden on small screens 
      and replaced by a button in the top right corner (try to re-size this 
      window). 
     <p>Only when the button is clicked, the navigation bar will be 
      displayed.</p> 
    </div> 

</body> 
</html> 
+0

请发布您正在查看的错误。 – leesei

+0

我无法上传图片@leesei ..它不允许我上传..对不起!没有错误。在本地主机上,它工作正常,但是当我用系统IP地址替换它时,导航栏即使在全屏上也会崩溃。 –

回答

相关问题