twitter-bootstrap 如何更改单击事件上的引导插入符指向方向

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25368802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 21:20:57  来源:igfitidea点击:

How to change the bootstrap caret pointing direction on click event

javascriptjquerycsstwitter-bootstraptwitter-bootstrap-2

提问by chalo

I'm using 2.3.2 bootstrap

我正在使用 2.3.2 引导程序

As I can change the position of the caret icon when I click the menu button.

因为我可以在单击菜单按钮时更改插入符号图标的位置。

I need that when I click the icon caret pointing up and when you click on another item the caret back to the initial state.

我需要当我单击指向上的图标插入符号时,当您单击另一个项目时,插入符号回到初始状态。

How is this possible?

这怎么可能?

The nav code

导航代码

<div id="navi">
    <div class="container">
      <nav>
        <div class="navbar">
          <div class="navbar-inner">
            <div class="row">
              <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>

              <div class="span2">
                <a class="brand" href="#"></a>
              </div>

              <div class="span10">
                <div class="nav-collapse collapse">
                  <div class="row">
                    <div class="span8">
                      <ul class="nav">
                        <li class="dropdown">
                          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Lorem 3 opes<b class="caret"></b></i></a>
                          <ul class="dropdown-menu">
                            <li><a href="#">Lorem</a></li>
                            <li><a href="institucional.html">Olosmpa</a></li>
                            <li><a href="#">Lorem 2 isum</a></li>

                          </ul>
                        </li>

                        <li class="dropdown">
                          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Lorem mas<b class="caret"></b></a>
                          <ul class="dropdown-menu">
                            <li><a href="#">Lorem</a></li>
                            <li><a href="institucional.html">Olosmpa</a></li>
                            <li><a href="#">Lorem 2 isum</a></li>

                          </ul>
                        </li>



                      </ul> 
                    </div><!-- /span8 -->

                    <div class="span2">
                      <div>
                        <form id="buscar-fixed" class="navbar-form form-search">
                          <div class="input-append">
                            <input class="inputBusqueda span2" type="text" placeholder="Buscar..." />
                            <button class="btn" type="button"><i class="icon-search icon-white"></i></button>


                          </div>
                        </form>

                      </div>
                    </div><!-- /span2 -->
                  </div><!-- /row -->
                </div><!--/.nav-collapse -->
              </div><!-- /span10 -->
            </div><!-- /row -->
          </div><!-- /nav-inner -->
        </div><!-- /navbar -->
      </nav>
    </div><!-- /container -->
  </div><!-- fin #nav-sup -->

Link to fiddle to try to resolve

链接到小提琴以尝试解决

Image example of the problem

问题的图像示例

回答by osahan

you can add this

你可以添加这个

.nav .dropdown.open .caret{
    border-top: none;
    border-bottom: 4px solid #000000;
}

Updated Fiddle

更新的小提琴

回答by Tariq Javed

Just add this CSS:

只需添加这个CSS:

   .navbar-default .navbar-nav>li>a:focus .caret{
        transform:rotate(-90deg);
        transition:all 0.3s ease-in-out; /*for smoothness*/
    }

回答by sarbbottam

Updated Fiddle

更新的小提琴

Added the following CSS

添加了以下 CSS

.navbar .nav li.dropdown.open>.dropdown-toggle .caret {
    border-top-color: transparent;
    border-bottom: 4px solid #000000;
    position: relative;
    top: -3px;
}

回答by Maximiliano Cesán

In css..
When .caretis a Class of arrows in a lior span.

在 css..
When.caret是 ali或 中的一类箭头span

.nav-list .caret {

    transform:rotate(-90deg);
    transition:all 0.3s ease-in-out; 
}

.nav-list .active .caret {

    transform:rotate(0deg);
    transition:all 0.4s ease-in-out;

}

100% Fun!.
Credits to Tariq Javed.

100% 乐趣!
归功于 Tariq Javed。