切换菜单立即消失

时间:2019-03-22 09:55:06

标签: javascript html css bootstrap-4

通过单击切换按钮,我仅能看到菜单(我在切换按钮上设置的菜单)仅四分之一秒,然后消失。我是新手。我可能犯了一些非常明显的错误。任何帮助表示赞赏。

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">    
    <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <title></title>
</head>
<body>
    <div class="container ">
        <nav class="navbar navbar-expand-sm  navbar-dark bg-dark">      
            <a href="#" class="navbar-brand"><img src="logo.png">The building co.</a>
            <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#myMenu">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="myMenu">
                <ul class="navbar-nav">
                    <li class="nav-item" > <a href="#" class="navbar-link">Home </a> </li>
                    <li class="nav-item" > <a href="#" class="navbar-link">contact us </a> </li>
                    <li class="nav-item" > <a href="#" class="navbar-link">policy </a> </li>
                    <li class="nav-item" > <a href="#" class="navbar-link">terms </a> </li>
                    <li class="nav-item" > <a href="#" class="navbar-link">About us </a> </li>          
                </ul>
            </div>
        </nav>  
    </div>
</body>
</html>

2 个答案:

答案 0 :(得分:0)

您丢失了或使用了错误的class ActionRespondWithUserMessage(Action): def name(self): return "action_respond_with_user_message" def run(self, dispatcher, tracker, domain): last_message = tracker.latest_message.get("text", "") dispatcher.utter_message(last_message) return [] 路径。纠正后,您的代码将起作用:

bootstrap.min.css

答案 1 :(得分:0)

首先,根据引导documentation,您将拥有确切的入门模板。

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>

之后,只需根据引导documentation sample放置 bootstrap导航栏组件链接即可。