简体   繁体   中英

Collapsable Menu Not Opening in Bootstrap Framework

I'm a first-time coder and know next to nothing. I'm trying to learn html, css, and js online. I'm trying to create aa responsive site where the navbar menu collapses on smaller resolutions. As of now the menu icon gets highlighted in white when I click on it but doesn't expand to show the items.

I'm using bootstrap 3.3.6 and jquery 2.1.4 (I know it's old but the course I'm learning from is using these)

Thanks in advance:, (PS, Ignore the content, names etc, I'm just trying to keep it interesting for myself)


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Gorilla Sports</title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/style_ch.css">
    <link href="https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,500;1,500&display=swap" rel="stylesheet">


</head>
<body>
    <header> 

        <nav id="header-nav" class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a href="index.html" class="pull-left visible-md visible-lg" >
                        <div id="logo-img" ></div>
                    </a>

                    <div class="navbar-brand">
                        <a href="index.html"><h1>Gorilla Sports</h1></a>
                        <p>
                            <img src="Images/gorilla_small.jpg" alt="Gorilla">
                            <span>Gorilla</span>
                        </p>
                    </div>

                    <button type="button" class="navbar-toggle collapsed"
                    data-toggle="collapse" data-target="#collapsable-nav"
                    aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>

                <div id="collapsable-nav" class="collapse navbar-collapse">
                    <ul id="nav-list" class="nav navbar-nav navbar-right">
                        <li>
                            <a href="menu-categories.html">
                                <span class="glyphicon glyphicon-cutlery"></span><br class="hidden-xs"> Menu</a>
                        </li>
                        <li>
                            <a href="#">
                                <span class="glyphicon glyphicon-info-sign"></span><br class="hidden-xs"> About</a>
                        </li>
                        <li>
                            <a href="#">
                                <span class="glyphicon glyphicon-certificate"></span><br class="hidden-xs"> Awards</a>
                        </li>
                        <li id="phone" class="hidden-xs">
                            <a href="tel:+91-9910673649">
                                <span>+91-9910673649</span></a><div>* We Deliver</div>
                        </li>
                    </ul>
                </div>
            </div>


        </nav>
    </header>



    <script type="text/javascript" src="jquery-2.1.4.js"></script>
    <script type="text/javascript" src="bootstrap.min.js"></script>
    <script type="text/javascript" src="script.js"></script>
</body>
</html>

https://jsfiddle.net/fjg1c5bk/ your collepse menu is working. Maybe your bootsrap libraries is not correct. Can u change them with belows and try again

<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM