如何更改click事件上的bootstrap插入符指向方向

时间:2014-08-18 17:26:16

标签: javascript jquery css twitter-bootstrap twitter-bootstrap-2

我正在使用2.3.2 bootstrap

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

当我点击指向上方的图标插入符号并且当您点击另一个项目时,我需要将插入符号重新设置为初始状态。

这怎么可能?

导航代码

<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

4 个答案:

答案 0 :(得分:12)

你可以添加这个

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

Updated Fiddle

答案 1 :(得分:4)

Updated Fiddle

添加了以下CSS

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

答案 2 :(得分:4)

只需添加此CSS:

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

答案 3 :(得分:2)

在css ..中 .caretlispan中的一类箭头。

.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%有趣! 致Tariq Javed的信用。