Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
932 views
in Technique[技术] by (71.8m points)

twitter bootstrap - Boostrap navbar not collapsing into button when page is minimised

Here are the boostrap cdn (css + js) links/main layouts page (laravel app)

They contain both the js and css

<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <!-- font awesome icon kit - check favourite tabs in chrome to get more -->
    <script src="https://kit.fontawesome.com/69e69f8319.js" crossorigin="anonymous"></script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{config('app.name', 'Coffee')}}</title>

    <!-- boostrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">

    <link rel="stylesheet" href="../css/app.css">

    <!-- ck editor cdn-->
    <script src="https://cdn.ckeditor.com/4.15.1/standard/ckeditor.js"></script>


    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <!-- Datatables link -->
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.23/css/dataTables.bootstrap4.min.css">

</head>
<body style="background-color: lightgrey !important;">
@include('inc.admin_navbar')
<div class="container">
    @yield('content')

    @if(session('success_message'))
        <div class="alert alert-success">
            {{session('success_message')}}
        </div>
    @endif
</div>

<!-- boostrap links -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>

<!-- datatables js link -->

<script src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.23/js/dataTables.bootstrap4.min.js"></script>

@include('sweetalert::alert')


</body>

</html>

Here is the navbar file that gets included in the layouts page. Ive spent hours looking for the issue but nothing seemed to work hopefully someone can spot a quick fix

<div style="margin-bottom: 2%">
    <nav class="navbar navbar-expand-lg bg-dark navbar-dark ">
        <div class="container">
            <a class="navbar-brand" href="/admin">Administration</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse d-flex justify-content-end " id="navbarNav">
                <ul class="navbar-nav ">
                    <li class="nav-item">
                        <a class="nav-link {{ Request::is('admin/create') ? 'active' : '' }}" aria-current="page" href="/admin/create">Add Cafe</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {{ Request::is('about') ? 'active' : '' }}" aria-current="page" href="/admin/cafes">Manage</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {{ Request::is('about') ? 'active' : '' }}" aria-current="page" href="">About</a>
                    </li>
                    <li class="nav-item is-active">
                        <a class="nav-link {{ Request::is('services') ? 'active' : '' }}" href="">Services</a>
                    </li>
                    <li class="nav-item is-active">
                        <a class="nav-link" href="/">Main Site</a>
                    </li>
                    <form action="{{ route('admin_logout') }}" method="post">
                        @csrf
                        <button type="submit" class="btn btn-warning">Logout</button>
                    </form>
                </ul>
            </div>
        </div>
    </nav>
</div>

The navlinks just stack when i try minimise the screen

question from:https://stackoverflow.com/questions/65946642/boostrap-navbar-not-collapsing-into-button-when-page-is-minimised

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...