How to change the bootstrap caret pointing direction on click event

后端 未结 4 1304
慢半拍i
慢半拍i 2021-02-09 15:32

I\'m using 2.3.2 bootstrap

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

相关标签:
4条回答
  • 2021-02-09 16:14

    Updated Fiddle

    Added the following CSS

    .navbar .nav li.dropdown.open>.dropdown-toggle .caret {
        border-top-color: transparent;
        border-bottom: 4px solid #000000;
        position: relative;
        top: -3px;
    }
    
    0 讨论(0)
  • 2021-02-09 16:15

    Just add this CSS:

       .navbar-default .navbar-nav>li>a:focus .caret{
            transform:rotate(-90deg);
            transition:all 0.3s ease-in-out; /*for smoothness*/
        }
    
    0 讨论(0)
  • 2021-02-09 16:17

    you can add this

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

    Updated Fiddle

    0 讨论(0)
  • 2021-02-09 16:33

    In css..
    When .caret is a Class of arrows in a li or 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.

    0 讨论(0)
提交回复
热议问题