Bootstrap下拉父菜单活动类 [英] Bootstrap dropdown parent menu active class

查看:49
本文介绍了Bootstrap下拉父菜单活动类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新秀在这里,寻找答案,却无法发现我在做什么错.

Rookie here, searched for answer and can't discover what i am doing wrong.

我的菜单在普通"菜单上的活动类中运行正常,但是我找不到使父菜单成为活动"菜单的解决方案.

My menu works fine in active class on "normal" menus, but I cannot find the solution to make the parent menu a "active" one.

![下拉菜单引导程序] [1]

![dropdown menu bootstrap][1]

代码:

<!-- /.abre dropdown -->
<li class="dropdown">
  <a data-toggle="dropdown" class="dropdown-toggle" href="#">O Que Fazer</a>
  <ul class="dropdown-menu">
    <li><a href="<?php bloginfo('url'); ?>/sem-sair-de-carro/">Sem Sair de Carro  <i class="icon-arrow-right"></i></a>
    <li><a href="<?php bloginfo('url'); ?>/de-carro-a-menos-de-15-minutos/">De Carro a Menos de 15 Minutos </a></li>
    <li><a href="<?php bloginfo('url'); ?>/usando-o-carro/">Usando O Carro </a></li>
  </ul>
</li>
<!-- /fecha dropdown -->

我想念什么?

我尝试了class ="active",但效果不好:

I tried the class="active" but no good:

<a data-toggle="dropdown" class="dropdown-toggle" class="active" href="#">O Que Fazer</a>

也许这是很基本的,但是四处寻找答案,却找不到深渊.

Maybe this is quite basic, but searched around for an answer and cannot find aby.

非常感谢

推荐答案

我知道您发布此信息已经6个月了,但我为您提供了一个解决方案:)

I know it has been 6 months since you posted this, but I have a solution for you :)

我在getbootstrap.com( http://getbootstrap.com/components中获得了这一标记./#navbar ),您只需在< li class ="dropdown"> 中添加"active"一词,就像下面的代码一样:

I have got this piece of mark up from the getbootstrap.com (http://getbootstrap.com/components/#navbar) and all you have to do is add the word 'active' in the <li class="dropdown"> like the code below:

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
   <ul class="nav navbar-nav">
       <li><a href="#">Link</a></li>
       <!--<li class="dropdown">-->
       <li class="dropdown active">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown">Industries <span class="caret"></span></a>
           <ul class="dropdown-menu" role="menu">
               <li><a href="#">Link1</a></li>
               <li><a href="#">Link2</a></li>
           </ul>
       </li>
   </ul>
</div>

我希望还不晚!

这篇关于Bootstrap下拉父菜单活动类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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