手机上的Bootstrap导航栏不起作用 [英] Bootstrap navbar on mobile not working

查看:41
本文介绍了手机上的Bootstrap导航栏不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的学校(巴西)的俱乐部制作一个网站,我想知道如何在移动设备上的网站中解决此问题.按下时,移动设备中的三行没有任何作用.

I'm making a site for my club in school (Brazil) and I'd like to know how to fix the issue in my site on mobile. The three lines in mobile when pressed don't do anything.

<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">

<title>ClubeDiversidade</title>
</head>
<style>
body {
background-color: orange;
}

</style>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Clube da diversidade</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavDropdown">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link" href="#">Pagina inicial <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Inscrição</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="sobrenatural.html">Sobrenatural</a>
      </li>
<li class="nav-item">
        <a class="nav-link" href="#">Tecnologia</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Outras atividades</a>
      </li>
    </ul>
  </div>
</nav>
<div class="container-fluid">
  <center>Bem-vindo!!</center>
</div>
</body>
</html>

推荐答案

Hi是指

我们的许多组件都需要使用JavaScript才能起作用.具体来说,它们需要jQuery,Popper.js和我们自己的JavaScript插件.将以下s放在页面末尾,紧接在</body>之前.标签,以启用它们.jQuery必须排在第一位,然后是Popper.js,然后是我们的JavaScript插件.

Many of our components require the use of JavaScript to function. Specifically, they require jQuery, Popper.js, and our own JavaScript plugins. Place the following s near the end of your pages, right before the closing </body> tag, to enable them. jQuery must come first, then Popper.js, and then our JavaScript plugins.

您需要将这些行添加到页面中才能工作.

You need to add these lines into your page in order to work.

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

我使用了 Bootstrap 4编辑器,并复制了您的代码,它运行良好,因为该编辑器具有内置的引导Javascript.

I used Bootstrap 4 Editor and copied your code in and it works perfectly, because the editor has built-in bootstrap javascripts.

这篇关于手机上的Bootstrap导航栏不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆