简体   繁体   English

Bootstrap下拉按钮问题

[英]Bootstrap Dropdown Button Problems

So I have just started playing around with bootstrap, and when I try to fallow the example per Getbootstrap's component page the button doesn't want to work as advertised. 因此,我才刚刚开始使用引导程序,当我尝试在每个Getbootstrap组件页面上使用示例时,该按钮不希望像宣传的那样工作。 I have seen and now tried a number of different solutions to this problem which has me thinking that I maybe over thinking what is wrong here. 我已经看到并且现在尝试了许多不同的解决方案来解决此问题,这使我认为我可能过度考虑了这里出了什么问题。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Rubish</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js">   </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="maindev1.0.0.css" />
<link rel="stylesheet" type="text/css" href="navbardev1.0.0.css" />
</head>
<body>
<div class="navbar-header pull-right">
<button id="menubutton" class="btn btn-default btn-md dropdown-toggle" data-toggle="dropdown" 
type="button" aria-expanded="false"><span class="glyphicon glyphicon-list"></span> </button>
</div>
<ul class="dropdown-menu" role="menu">
    <li><a href="#">yadayada</a>
    </li>
    <li class="divider"></li>
    <li><a href="#">yadayada</a>
    </li>
    <li class="divider"></li>
    <li><a href="#">yadayada</a>
    </li>
    <li class="divider"></li>
    <li><a href="#">yadayada</a>
    </li>
    <li class="divider"></li>
    <li><a href="#">yadayada</a>
    </li>

</ul>


</body>

</html>

I can get the button to show up and it looks like its active when I click it but it can not get the drop down to appear. 我可以显示该按钮,单击该按钮时它看起来像是活动的,但无法显示下拉菜单。 I have tried it with Safari, Chrome, and Firefox with the same result in all three. 我已经在Safari,Chrome和Firefox中对其进行了尝试,但在这三个方面都得到了相同的结果。 Is there something that I am forgetting? 有什么我忘记的事情吗?

You don't say if it is in a navbar or just a normal one. 您不会说它是在导航栏中还是在普通导航栏中。 From your code it looks like you are trying top do it in a navbar. 从您的代码看来,您似乎正在尝试在导航栏中完成此操作。 I also included a normal dropdown button. 我还包括一个普通的下拉按钮。

fiddle: https://jsfiddle.net/DTcHh/8607/ 小提琴: https : //jsfiddle.net/DTcHh/8607/

<!-- Normal Single Dropdown button -->
<div class="btn-group">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
    Action <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li><a href="#">Separated link</a></li>
  </ul>
</div>

 select {background-color: blue; color: white; border: 2px solid; border-radius: 6px;} 
 <select name="yada"> <option value="yada">yada</option> <option value="yada">yada</option> <option value="yada">yada</option> <option value="yada">yada</option> </select> 

Why not just replace the button with a dropdown like this and then style it to look like a button? 为什么不只用这样的下拉菜单替换按钮,然后将其样式设置为按钮呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM