How to fix my lists, so I don’t have to switch twice before updating the icon?

Basically, when I load my page and then drop either my external collapsible menu ( .admin) or the nested reset menu ( .unitsofstudy), it does not update the glyphicon that I set using :afterif I don't switch it twice.

Someone can take a look and see if they can determine where I ruined it; I’ve been trying to fix it for several hours, but to no avail. If you need more information, let me know.

HTML:

<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
    <ul class="nav menu" id="navmenu-sidebar">
        <!-- Admin dropdown -->
        <li>
            <a class="admin" data-toggle="collapse" href="#admin"><i class="fa fa-tasks" style="margin-right: 16px;"></i>Admin</a>
            <ul id="admin" class="nav collapse">
                <li>
                    <a class="unitsofstudy" data-toggle="collapse" href="#unitsofstudy"> &nbsp; &nbsp;<i class="fa fa-book" style="margin-right: 12px;"></i>Units of Study</a>
                    <ul id="unitsofstudy" class="nav collapse">
                        <li>
                            <a href="@Url.Content("~/Admin/Units")"> &nbsp; &nbsp; &nbsp; &nbsp;<i class="fa fa-book" style="margin-right: 8px;"></i> View Units</a>
                        </li>
                        <li>
                            <a href="@Url.Content("~/Admin/NewOfferedUnit")"> &nbsp; &nbsp; &nbsp; &nbsp;<i class="fa fa-plus" style="margin-right: 10px;"></i> Create Unit Offerings</a>
                        </li>
                        <li>
                            <a href="@Url.Content("~/Admin/NewUnit")"> &nbsp; &nbsp; &nbsp; &nbsp;<i class="fa fa-plus" style="margin-right: 10px;"></i> Register Units</a>
                        </li>
                        <li>
                            <a href="@Url.Content("~/Admin/NewSemester")"> &nbsp; &nbsp; &nbsp; &nbsp;<i class="fa fa-plus" style="margin-right: 10px;"></i> Register Semesters</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
    </ul>
</div>

My CSS:

.admin:after, .unitsofstudy:after {
    font-family: 'Glyphicons Halflings'; 
    content: "\e114";    
    float: right;       
    color: grey;        
}
.admin.collapsed:after, .unitsofstudy.collapsed:after {
    content: "\e080";   
}
+4
source share
1 answer

.collapsed

<li>
    <a class="admin collapsed" data-toggle="collapse" href="#admin">
        <i class="fa fa-tasks" style="margin-right: 16px;"></i>Admin
    </a>
</li>

, admin unitsofstudy ,

http://codepen.io/jcoulterdesign/pen/6443069430f54e0b635e726c2cb9da02

+1

All Articles