These are the two types of common knowledge I know.
The first one: to illustrate that I used the Fontawesome font, the first to go to the official website to download to use
<span class= ' btn btn-more ' >
<i class= ' fa fa-angle-down ' ></i>
<i class= ' FA fa-angle-up Hidden ' ></i>
</span>
I use the bootstrap, so the hidden is self-contained, the above initial state is the down arrow Angle-down is displayed, and then the upper arrow angle-up is hidden.
On 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, when the content is displayed may be used
The second approach is that the HTML code
<li class= "sub-item" >
<a href= "javascript:;" >
<span 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 approach is primarily to overwrite the previous content by adding a class, which is also the Fonawesome font.
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, but also hope that a lot of support cloud Habitat community!