Click the down arrow?? Change the arrow?? Two ways to switch back and forth

Source: Internet
Author: User

Tag: color CTI This mil value awesome nbsp weight code

All I know is that these two kinds are common.

The first kind: Explain that I use the Fontawesome font, first to go to the official website to download to use

class='btn btn-more'>
class='fa fa-angle-down'></i>
class='fa fa-angle-up hidden'></i>
</span>

I use bootstrap, so the hidden is self-brought, the above initial state is the down arrow Angle-down is displayed, and then the arrow angle-up is hidden.

On the JS code:

    $ ('. Btn-more'). Click (function (EV) {            $ (this). Children('  . Fa-angle-down'). Toggleclass ('hidden');        $ (this). Children ('. fa-angle-up'). Toggleclass (' Hidden ' );    })

In this way, the up and down arrows can be switched back and forth, in general, it may be used when displaying content

The second method is that the HTML code

                       class="sub-item">                                <a href="javascript:; ">                                                                    class="arrow"></span>                                </a>                            </li>

CSS Code

 .arrow:before { float  : right;    width:20px;    Text -align:center;    Display:inline;    Font -SIZE:16PX;    Font -family:fontawesome;    Height:auto; Content:   " \f104  "  ;    Font -weight: 300  ;    Text -shadow:none;    Position:absolute;    top:4px;    right:14px; Color: #  990  ;} 
. arrow.open:before{
content:  ' \f107 ';
}

JS Code is

$ ('. Nav-item>a'). Click (function () {$ (this). Children (' . Arrow '). Toggleclass ('open')})

The second method is mainly to add a class to cover the previous content, the same fonawesome font ha

Click the down arrow?? Change the arrow?? Two ways to switch back and forth

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.