【问题标题】:Bootstrap installation issues with popper and jquerypopper 和 jquery 的引导安装问题
【发布时间】:2020-07-30 16:53:40
【问题描述】:

我正在尝试安装 Bootstrap,但它不起作用。我从 Bootstrap 网站获得了 csshtml,它们似乎工作正常,但我认为 popperjquery 工作不正常。我已经尝试从他们的网页上使用npm 安装两者,并且它们没有显示任何错误,但是当我尝试运行代码时,它们没有显示我想要的,这是一个旋转木马应该可以正常工作是的,图像只是保持静止,不会改变,只有 csshtml 工作。我知道这不是轮播结构,因为我尝试使用cdn。我有部分代码没有下面的轮播。在这些情况下有什么可做的吗?

    <!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="Arquivos2/bootstrap-4.5.0-dist/css/bootstrap.min.css">


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

             <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="/Arquivos2/jquery-3.5.1.js"></script> 
    <script src="/Arquivos2/jquery22/node_modules/@popperjs/core/dist/esm/popper.js"></script>
    <script src="/Arquivos2/bootstrap-4.5.0-dist/js/bootstrap.min.js"></script>

       
              
          </div>
  </body>
</html>

【问题讨论】:

  • 你应该放一个'.' (点)表示相对路径,例如,您的脚本的 src 路径变为 ./Arquivos2/jquery-3.5.1.js。或者为了保持 URL 一致,只需删除正斜杠,就像链接引导 CSS 文件一样。
  • visualcode 只是掉栏,我只是选择文件夹,所以我没有意识到。谢谢,成功了!

标签: html jquery css popper.js


【解决方案1】:
<!-- First jQuery | then Popper | then Bootstrap -->
<!-- Use the umd directory to import popper. -->

<script src="./node_modules/jquery/dist/jquery.js"></script>
<script src="./node_modules/@popperjs/core/dist/umd/popper.js"></script>
<script src="./node_modules/bootstrap/dist/js/bootstrap.js"></script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-23
    相关资源
    最近更新 更多