无法使用引导程序使用下拉菜单

时间:2018-06-24 18:43:23

标签: jquery html css twitter-bootstrap

我完全按照getbootstrap的教程使用,完全按照它说的去做,但是不起作用,我单击它,什么也没出现。 我添加了HTML文件头,因为你们告诉我我的jquery和bootstrap CND可能有问题,所以这里是:

<!DOCTYPE HTML>

<html>
    
    <head>
        <title> 
            hah?
        </title>
        <link href="CSS/style.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
        <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    </head>
    
    <body>
        
        
        
        <div class="container-fluid" id="container2">
            <a href="" id="g2glogo"></a>
            <div class="dropdown">
              <button class="btn-category dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown">
                CATEGORIES
              </button>
              <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                <a class="dropdown-item" href="#">CURRENCY</a>
                <a class="dropdown-item" href="#">TOP UP</a>
                <a class="dropdown-item" href="#">ITEMS</a>
              </div>
            </div>
            
           
        </div>
        
        
        
        
        
    </body>
    
</html>

2 个答案:

答案 0 :(得分:0)

您需要包括jQuery,popper以及引导JS和CSS才能起作用。这是一个工作片段。

from pyspark.sql.functions import explode
df=spark.read.json('dataMay-31-2017.json',multiLine=True)
ndf=df.select(explode(df.data))
ndf.rdd.map(lambda r:tuple(r.col))
.btn-category{
    background-color: #F7F7FA;
    border-radius: 4px;
    padding: 7px 15px;
    margin: 35px 0 0 0;
    border: 1px solid red;
    color: red;
    font-size: 12px;

}
.btn-category:focus {
  outline: none;
}

您可以在这里找到缺少的库:http://getbootstrap.com/docs/4.1/getting-started/introduction/

答案 1 :(得分:0)

您必须在正文的末端标签中包含javascript文件。因此,请勿将它们导入您的脑海。尝试在代码段下方复制和粘贴。希望这会有所帮助。

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <title>StackOverflow</title>
  </head>
  <body>
    <div class="container-fluid" id="container2">
      <a href="" id="g2glogo"></a>
      <div class="dropdown">
        <button class="btn-category dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown">
          CATEGORIES
        </button>
        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
          <a class="dropdown-item" href="#">CURRENCY</a>
          <a class="dropdown-item" href="#">TOP UP</a>
          <a class="dropdown-item" href="#">ITEMS</a>
        </div>
      </div>


    </div>

    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <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>
  </body>
</html>