在子菜单链接上工作正常后,fontawesome图标

时间:2015-07-05 07:32:49

标签: css font-awesome

在我的边栏上,我有一个名为Multilevel Menu

的链接

每个父链接在css中都有一个V形右图标。

当它点击打开它然后变成雪佛龙图标。

我遇到的问题是在我的子菜单链接上有父类我无法在链接打开时让雪佛龙图标工作

问题什么是最好的解决方案,以便在我的子菜单链接打开时添加chevron down icon当前子菜单链接只能让chevron正确

Codepen示例Click Here

/* Sidebar Menu */

#menu, 
#menu ul, 
#menu li {
    padding: 0;
    margin: 0;
    min-height: 100%;
    list-style: none;
}

#menu {
    margin-bottom: 25px;
}

#menu > li {
    position: relative;
}

#menu li a {
    text-decoration: none;
    display: block;
    padding: 10px;
    cursor: pointer;
    color: #aaaaaa;
    border-bottom: 1px solid #2d2d2d;
}

#menu li a i {
    color: rgba(170, 170, 170, 0.7);
    font-size: 16px;
}

#menu > li > a {
    color: #aaaaaa;
    font-size: 14px;    
    padding-left: 13px;
}

#menu > li > a:hover {
    background-color: #444444;
}

#menu > li > a > span {
    display: none;
    margin-left: 8px;
}

#menu li li a {
    border-bottom: none !important;
}

#menu li li a:hover {
    color: #aaaaaa;
    background-color: #1e1e1e;
}

/*
#menu li li a:before {
    content: "\f101";
    font-size: 14px;
    font-family: FontAwesome;
    margin-left: 10px;
    margin-right: 10px;
    transition: margin ease 0.5s;   
}
*/
#menu li li a:hover:before {
    margin-right: 20px;
}

#menu > li.active > a {
    color: #aaaaaa;
    background: #242424;
}

#menu li.active li a {
    color: #aaaaaa;
}

#menu li li.active > a:last-child {
    color: #aaaaaa;
}

#menu li li.active a:last-child:before {
    margin-left: 20px;
    margin-right: 10px;
}

#menu > li > ul {
    position: absolute;
    left: 50px;
    top: 0px;
    width: 210px;
    background-color: #313131;
    visibility: hidden;
}

#menu li ul {
    overflow: hidden;
}

#menu li li a.parent:after, #column-left.active #menu > li a.parent:after {
    font-family: FontAwesome;
    content: "\f105";
    float: right;
    margin-right: 8px;
}

#menu li li.open > a.parent:after, #column-left.active #menu > li.open > a.parent:after {
    font-family: FontAwesome;
    content: "\f107";
    float: right;
    margin-right: 8px;
}

#menu li ul a {
    padding-left: 20px;
}

#menu li li ul a {
    padding-left: 40px;
}

#menu li li li ul a {
    padding-left: 60px;
}

#menu li li li li ul a {
    padding-left: 60px;
}

#menu li li li a.parent:after, #column-left.active #menu > li a.parent:after {
    font-family: FontAwesome;
    content: "\f105";
    float: right;
    margin-right: 8px;
}

#menu li li li.open > a.parent:after, #column-left.active #menu > li.open > a.parent:after {
    font-family: FontAwesome;
    content: "\f107";
    float: right;
    margin-right: 8px;
}

1 个答案:

答案 0 :(得分:2)

解决问题

我不得不广告

#menu li ul li a.parent:after, #column-left.active #menu > li ul li a.parent:after {
    font-family: FontAwesome;
    content: "\f105";
    float: right;
    margin-right: 8px;
}

#menu li ul li.open > a.parent:after, #column-left.active #menu > li ul li.open > a.parent:after {
    font-family: FontAwesome;
    content: "\f107";
    float: right;
    margin-right: 8px;
}