dongwei7245 2018-04-19 07:00
浏览 113
已采纳

Navbar引导程序菜单未显示在移动设备中

Here's my header.php When I try it out on my mobile, the navigation bar doesn't work on mobile. all menu properly shown in desktop screen but it doesn't display in tab or mobile. here is my code.

<!DOCTYPE html>
<html>
<head>

<title>International Pvt. Ltd.</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://stackpath.bootstrapcdn.com/bootswatch/4.1.0/minty/bootstrap.min.css" rel="stylesheet" integrity="sha384-b8rPE9Kj0lNck6sxWxUIJRCE3IHrqNXF74vcnXKYS/NZPi7WInVsaIKeEjIDpyNt" crossorigin="anonymous">
    <link rel="stylesheet" href="#assets/css/style.css">
    <script src="https://cdn.ckeditor.com/4.9.1/standard/ckeditor.js">/script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">International</a>
            </div>

            <div class="collapse navbar-collapse" id="navbarColor01">
                <ul class="navbar-nav mr-auto" >
                    <li class="nav-item"><a class="nav-link" href="#">Home</a</li>
                    <li class="nav-item"><a class="nav-link" href="#about">About</a></li>
                    <li class="nav-item"><a class="nav-link" href="#posts">Blog</a></li>
                    <li class="nav-item"><a class="nav-link" href="#categories">Categories</a></li>

                    <?php if(!$this->session->userdata('logged_in')) : ?>
                    <li class="nav-item"><a class="nav-link" href="#users/login">Login</a></li>
                    <li class="nav-item"><a class="nav-link" href="#users/register">Register</a></li>
                    <?php endif; ?>
                    <?php if($this->session->userdata('logged_in')) : ?>
                    <li class="nav-item"><a class="nav-link" href="#posts/create">Create Post</a></li>
                    <li class="nav-item"><a class="nav-link" href="#categories/create">Create Category</a></li>
                    <li class="nav-item"><a class="nav-link" href="#users/logout">Logout</a></li>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </nav>
[...]
</body>
  • 写回答

3条回答 默认 最新

  • douzhuan1169 2018-04-19 07:10
    关注

    Your navbar is hidden. Add some button (hamburger) which will show Your navbar:

    <div class="col-10 text-right d-md-none">
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                </div>
    

    Put it before div with yours ul.This code example is from my project - Of course You have to adjust classes to Your project.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化