我正在尝试制作一个下拉菜单,单击时会显示.downdown内容,如果用户单击栏中的任何其他下拉菜单,则该内容会消失。问题是我有多个下拉类,我想我只需要帮助修改我现有的javascript。我希望侧边栏(导航(只显示当前活动的下拉菜单。在我的代码中,当你打开下拉列表时,它仍然打开,直到用户再次单击下拉箭头关闭特定的下拉列表。
$(document).ready(function() {
"use strict"; // Start of use strict
//Sidebar menu
$('.show-sidebar').on('click', function() {
$('#sidebar').toggleClass('collapse-sidebar');
$('#layout-admin').toggleClass('collapse-sidebar');
});
$('.has-sub').on('click', function() {
$('.has-sub').toggleClass('open-dropdown');
$('.sub-nav').slideToggle("slow");
});
$('.has-sub2').on('click', function() {
$('.has-sub2').toggleClass('open-dropdown');
$('.sub-nav2').slideToggle("slow");
});
$('.has-sub3').on('click', function() {
$('.has-sub3').toggleClass('open-dropdown');
$('.sub-nav3').slideToggle("slow");
});
$('.has-sub4').on('click', function() {
$('.has-sub4').toggleClass('open-dropdown');
$('.sub-nav4').slideToggle("slow");
});
$('.has-sub5').on('click', function() {
$('.has-sub5').toggleClass('open-dropdown');
$('.sub-nav5').slideToggle("slow");
});
$('.has-sub6').on('click', function() {
$('.has-sub6').toggleClass('open-dropdown');
$('.sub-nav6').slideToggle("slow");
});
$('.has-sub7').on('click', function() {
$('.has-sub7').toggleClass('open-dropdown');
$('.sub-nav7').slideToggle("slow");
});
});
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-size: 14px;
color: #000;
background-color: #fff;
margin: 0;
line-height: 1.42857143;
font-family: "Segoe WP Light", "Segoe UI", "Arial", sans-serif;
}
body {
font-size: 14px;
color: #000;
background-color: #fff;
margin: 0;
line-height: 1.42857143;
font-family: "Segoe WP Light", "Segoe UI", "Arial", sans-serif;
}
/*============================
Header
============================*/
.wrapper {
width: 100%;
height: 100%;
position: relative;
}
ul li a .icon {
height: 40px;
width: 40px;
margin-right: 13px;
background: #ffffff1a;
display: flex;
justify-content: center;
text-align: center;
border-radius: 50%;
}
ul li a .icon span {
line-height: 40px;
font-size: 20px;
color: #b0b3b8;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
span.field-requried {
color: red;
}
.hide {
display: none;
}
#sidebar {
min-width: 250px;
max-width: 250px;
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
background-image: linear-gradient(to bottom, #000, #333);
transition: all 0.3s;
position: fixed;
top: 0;
height: 100vh;
}
#sidebar .sidebar-header {
padding: 15px 5px;
text-align: center;
height: 60px;
}
#sidebar .sidebar-header img {
width: 100px;
height: auto;
vertical-align: middle;
}
#sidebar ul.list-unstyled li {
margin-bottom: 10px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
#sidebar ul.list-unstyled li a {
height: 40px;
padding: 8px 25px;
font-weight: 700;
color: #ffffff;
letter-spacing: 0.1px;
display: block;
text-decoration: none;
text-transform: uppercase;
white-space: nowrap;
position: relative;
}
#sidebar ul.list-unstyled li a.has-sub::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub2::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub3::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub4::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub5::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub6::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub7::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub8::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub2.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub3.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub4.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub5.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub6.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub7.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub8.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a i {
font-size: 16px;
width: 18px;
text-align: center;
margin-right: 15px;
}
#sidebar ul.list-unstyled li:first-child a i {
font-size: 18px;
}
#sidebar ul.list-unstyled li:hover,
#sidebar ul.list-unstyled li.active {
background-color: rgba(255, 255, 255, 0.15);
}
#sidebar.collapse-sidebar {
min-width: 50px;
max-width: 50px;
text-align: center;
}
#sidebar.collapse-sidebar .sidebar-header img {
width: 40px;
}
#sidebar ul.list-unstyled {
padding: 0;
margin: 0;
list-style: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li a {
height: 60px;
padding: 20px 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a i {
font-size: 18px;
width: 20px;
margin-right: 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li:first-child a i {
font-size: 20px;
}
#layout-admin {
-webkit-transform: translate3d(50px, 0, 0);
transform: translate3d(50px, 0, 0);
width: calc(100% - 50px);
min-height: 100vh;
transition: all 0.3s;
background-color: #f5f7f9;
}
#layout-admin .header {
height: 60px;
background-color: rgb(232, 2, 21);
box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 20px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px 0 15px;
position: sticky;
z-index: 10;
top: 0;
width: 100%;
}
#layout-admin .header .header-left {
font-size: 0;
}
#layout-admin .header .header-right>div {
display: inline-block;
}
#layout-admin .header .header-right a {
font-size: 28px;
color: #fff;
}
#username {
font-size: 20px;
vertical-align: middle;
padding-bottom: 10px;
margin-right: 10px;
}
#layout-admin .header .header-right .setting {
margin-right: 40px;
}
#layout-admin .header .header-left button.show-sidebar {
background-color: transparent;
border: none;
font-size: 28px;
color: #fff;
/*-webkit-text-stroke: 1.5px white;*/
display: inline-block;
vertical-align: middle;
margin-right: 25px;
outline: none;
cursor: pointer;
}
#layout-admin .header .header-left .logo {
display: inline-block;
vertical-align: middle;
}
#layout-admin .header .header-left .title {
display: inline-block;
vertical-align: middle;
font-size: 22px;
font-weight: 600;
color: #fff;
}
#layout-admin .header .header-left .title span {
font-weight: normal;
}
#layout-admin .content-admin {
padding: 20px;
}
#layout-admin .content-admin .title-content {
font-size: 20px;
font-weight: 600;
line-height: 1.1;
margin-bottom: 30px;
}
#layout-admin.collapse-sidebar {
width: calc(100% - 250px);
transform: translate3d(250px, 0, 0);
-webkit-transform: translate3d(250px, 0, 0);
-moz-transform: translate3d(250px, 0, 0);
-ms-transform: translate3d(250px, 0, 0);
-o-transform: translate3d(250px, 0, 0);
}
.sub-nav,
.sub-nav2,
.sub-nav3,
.sub-nav4,
.sub-nav5,
.sub-nav6,
.sub-nav7,
.sub-nav8 {
display: none;
margin: 0;
padding: 0;
list-style: none;
}
.sub-nav li,
.sub-nav2 li,
.sub-nav3 li,
.sub-nav4 li,
.sub-nav5 li,
.sub-nav6 li,
.sub-nav7 li,
.sub-nav8 li {
font-size: 14px;
color: #fff;
list-style: none;
padding: 8px 15px 8px 30px;
}
#sidebarCollapse-mobile {
display: none;
background-color: transparent;
border: none;
font-size: 28px;
color: #fff;
vertical-align: middle;
margin-right: 25px;
outline: none;
cursor: pointer;
}
@media (max-width: 767px) {
#sidebar {
min-width: 0px;
max-width: 0px;
text-align: center;
}
#sidebar.collapse-sidebar {
min-width: 250px;
max-width: 250px;
text-align: left;
z-index: 1;
}
#sidebar .sidebar-header img {
width: 40px;
}
#sidebar.collapse-sidebar .sidebar-header img {
width: 100px;
}
#sidebar ul.list-unstyled li a {
height: 60px;
padding: 20px 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a {
height: 40px;
padding: 8px 25px;
}
#sidebar ul.list-unstyled li a i {
font-size: 18px;
width: 20px;
margin-right: 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a i {
font-size: 16px;
width: 18px;
margin-right: 15px;
}
#sidebar ul.list-unstyled li:first-child a i {
font-size: 20px;
}
#sidebar.collapse-sidebar ul.list-unstyled li:first-child a i {
font-size: 18px;
}
#sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: inline-block;
}
*#layout-admin {
-webkit-transform: translate3d(0px, 0, 0);
transform: translate3d(0px, 0, 0);
width: calc(100% - 0px);
}
#layout-admin.collapse-sidebar {
width: calc(100% - 0px);
transform: translate3d(0px, 0, 0);
-webkit-transform: translate3d(0px, 0, 0);
-moz-transform: translate3d(0px, 0, 0);
-ms-transform: translate3d(0px, 0, 0);
-o-transform: translate3d(0px, 0, 0);
}
#layout-admin .header .header-left .title {
font-size: 16px;
}
#layout-admin .header .header-right a {
font-size: 22px;
}
#username {
font-size: 14px;
}
#sidebar.collapse-sidebar #sidebarCollapse-mobile {
display: inline-block;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<script
src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</head>
<body>
<nav id="sidebar">
<!--------------------- Sidebar header ---------------------------->
<div class="sidebar-header">
<a href="#"><img src="/common/images/logo.svg" alt="logo"></a>
<button type="button" id="sidebarCollapse-mobile" class="show-sidebar">
<i class="fa fa-bars"></i>
</button>
</div>
<!--------------------- Sidebar menu ---------------------------->
<ul class="list-unstyled nav-links">
<li class="active">
<a href="#">
<i class="fa fa-home" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Home</span>
</a>
</li>
<li id="li-pendingorders">
<a href="javascript:void(0)" class="has-sub open-dropdown">
<i class="fas fa-box-open" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Pending Orders</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-collectorders" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-crosshairs"></span> Collect orders</a>
</li>
<li id="li-addneworder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-box-open"></span> Partial collect</a>
</li>
<li id="li-warehousecollect" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-warehouse"></span> Warehouse collect</a>
</li>
<li id="li-outofstock" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-surprise"></span> Out of Stock</a>
</li>
<li id="li-ordered" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-thumbtack "></span> Ordered</a>
</li>
<li id="li-rts" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-recycle"></span> RTS</a>
</li>
<li id="li-awaitinglist" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-pause-circle"></span> Awaiting List</a>
</li>
</ul>
</li>
<li id="li-manageorders">
<a href="javascript:void(0)" class="has-sub3 open-dropdown">
<i class="fa fa-tasks" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Manage Orders</span>
</a>
<ul class="sub-nav3" style="display: none;">
<li id="li-addneworder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-eye"></span> View Order</a>
</li>
<li id="li-warehousecollect" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-plus"></span> Create Order</a>
</li>
</ul>
</li>
<li id="li-packorders">
<a href="javascript:void(0)" class="has-sub5 open-dropdown">
<i class="fa fa-tape" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Pack Orders</span>
</a>
<ul class="sub-nav5" style="display: none;">
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tape"></span> Pack Orders</a>
</li>
</ul>
</li>
<li id="li-manageinventory">
<a href="javascript:void(0)" class="has-sub7 open-dropdown">
<i class="fa fa-table" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Manage Inventory</span>
</a>
<ul class="sub-nav7" style="display: none;">
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-sliders-h"></span> Adjust Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-truck-loading"></span> Receive Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-dolly"></span> Ship Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-map-marked-alt"></span> Locations</a>
</li>
</ul>
</li>
<li id="li-orderdownload">
<a href="#">
<i class="fa fa-download" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Download Orders</span>
</a>
</li>
<li id="li-tracking">
<a href="javascript:void(0)" class="has-sub2 open-dropdown">
<i class="fas fa-shipping-fast" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Tracking</span>
</a>
<ul class="sub-nav2" style="display: none;">
<li id="li-markorderassent" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-truck"></span> Mark Order as Sent</a>
</li>
<li id="li-downloatrackings" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-arrow-down"></span> Download Trackings</a>
</li>
<li id="li-uploadtrackings" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-arrow-up"></span> Upload Trackings</a>
</li>
</ul>
</li>
<li id="labels">
<a href="javascript:void(0)" class="has-sub4 open-dropdown">
<i class="fas fa-tags"></i>
<span class='sidebar-menu-text'>Labels</span>
</a>
<ul class="sub-nav4" style="display: none;">
<li id="li-createlabels" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tag"></span> Create Labels</a>
</li>
<li id="li-morelabels" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tags"></span> More Labels (template)</a>
</li>
</ul>
</li>
<li id="refunds">
<a href="#">
<i class="fas fa-money-bill-wave"></i>
<span class='sidebar-menu-text'>Refunds</span>
</a>
</li>
<li id="manageadm">
<a href="javascript:void(0)" class="has-sub6 open-dropdown">
<i class="fas fa-users-cog" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Admin</span>
</a>
<ul class="sub-nav6" style="display: none;">
<li id="li-usermanagement" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-user-cog"></span> User Management</a>
</li>
<li id="li-packermanagement" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-toolbox"></span> Packer Management</a>
</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
您的代码有很多可重复使用的代码。试试这个。
$(document).ready(function() {
"use strict"; // Start of use strict
$('.show-sidebar').on('click', function() {
$('#sidebar').toggleClass('collapse-sidebar');
$('#layout-admin').toggleClass('collapse-sidebar');
});
$('li a.has-sub').on('click', function() {
// For toggle its own li
$(this).toggleClass('open-dropdown');
$(this).parent().find('.sub-nav').slideToggle("slow");
// For other li
$(this).parent().siblings().children('a.has-sub').removeClass('open-dropdown');
$(this).parent().siblings().children('ul.sub-nav').slideUp("slow");
});
});
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-size: 14px;
color: #000;
background-color: #fff;
margin: 0;
line-height: 1.42857143;
font-family: "Segoe WP Light", "Segoe UI", "Arial", sans-serif;
}
body {
font-size: 14px;
color: #000;
background-color: #fff;
margin: 0;
line-height: 1.42857143;
font-family: "Segoe WP Light", "Segoe UI", "Arial", sans-serif;
}
/*============================
Header
============================*/
.wrapper {
width: 100%;
height: 100%;
position: relative;
}
ul li a .icon {
height: 40px;
width: 40px;
margin-right: 13px;
background: #ffffff1a;
display: flex;
justify-content: center;
text-align: center;
border-radius: 50%;
}
ul li a .icon span {
line-height: 40px;
font-size: 20px;
color: #b0b3b8;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
span.field-requried {
color: red;
}
.hide {
display: none;
}
#sidebar {
min-width: 250px;
max-width: 250px;
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.16);
background-image: linear-gradient(to bottom, #000, #333);
transition: all 0.3s;
position: fixed;
top: 0;
height: 100vh;
}
#sidebar .sidebar-header {
padding: 15px 5px;
text-align: center;
height: 60px;
}
#sidebar .sidebar-header img {
width: 100px;
height: auto;
vertical-align: middle;
}
#sidebar ul.list-unstyled li {
margin-bottom: 10px;
transition: all 0.5s ease;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
}
#sidebar ul.list-unstyled li a {
height: 40px;
padding: 8px 25px;
font-weight: 700;
color: #ffffff;
letter-spacing: 0.1px;
display: block;
text-decoration: none;
text-transform: uppercase;
white-space: nowrap;
position: relative;
}
#sidebar ul.list-unstyled li a.has-sub::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub2::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub3::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub4::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub5::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub6::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub7::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub8::after {
content: "f104";
font-family: 'FontAwesome';
color: #fff;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
position: absolute;
right: 15px;
}
#sidebar ul.list-unstyled li a.has-sub.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub2.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub3.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub4.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub5.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub6.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub7.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a.has-sub8.open-dropdown:after {
content: "f107";
}
#sidebar ul.list-unstyled li a i {
font-size: 16px;
width: 18px;
text-align: center;
margin-right: 15px;
}
#sidebar ul.list-unstyled li:first-child a i {
font-size: 18px;
}
#sidebar ul.list-unstyled li:hover,
#sidebar ul.list-unstyled li.active {
background-color: rgba(255, 255, 255, 0.15);
}
#sidebar.collapse-sidebar {
min-width: 50px;
max-width: 50px;
text-align: center;
}
#sidebar.collapse-sidebar .sidebar-header img {
width: 40px;
}
#sidebar ul.list-unstyled {
padding: 0;
margin: 0;
list-style: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li a {
height: 60px;
padding: 20px 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a i {
font-size: 18px;
width: 20px;
margin-right: 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li:first-child a i {
font-size: 20px;
}
#layout-admin {
-webkit-transform: translate3d(50px, 0, 0);
transform: translate3d(50px, 0, 0);
width: calc(100% - 50px);
min-height: 100vh;
transition: all 0.3s;
background-color: #f5f7f9;
}
#layout-admin .header {
height: 60px;
background-color: rgb(232, 2, 21);
box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 20px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px 0 15px;
position: sticky;
z-index: 10;
top: 0;
width: 100%;
}
#layout-admin .header .header-left {
font-size: 0;
}
#layout-admin .header .header-right>div {
display: inline-block;
}
#layout-admin .header .header-right a {
font-size: 28px;
color: #fff;
}
#username {
font-size: 20px;
vertical-align: middle;
padding-bottom: 10px;
margin-right: 10px;
}
#layout-admin .header .header-right .setting {
margin-right: 40px;
}
#layout-admin .header .header-left button.show-sidebar {
background-color: transparent;
border: none;
font-size: 28px;
color: #fff;
/*-webkit-text-stroke: 1.5px white;*/
display: inline-block;
vertical-align: middle;
margin-right: 25px;
outline: none;
cursor: pointer;
}
#layout-admin .header .header-left .logo {
display: inline-block;
vertical-align: middle;
}
#layout-admin .header .header-left .title {
display: inline-block;
vertical-align: middle;
font-size: 22px;
font-weight: 600;
color: #fff;
}
#layout-admin .header .header-left .title span {
font-weight: normal;
}
#layout-admin .content-admin {
padding: 20px;
}
#layout-admin .content-admin .title-content {
font-size: 20px;
font-weight: 600;
line-height: 1.1;
margin-bottom: 30px;
}
#layout-admin.collapse-sidebar {
width: calc(100% - 250px);
transform: translate3d(250px, 0, 0);
-webkit-transform: translate3d(250px, 0, 0);
-moz-transform: translate3d(250px, 0, 0);
-ms-transform: translate3d(250px, 0, 0);
-o-transform: translate3d(250px, 0, 0);
}
.sub-nav,
.sub-nav2,
.sub-nav3,
.sub-nav4,
.sub-nav5,
.sub-nav6,
.sub-nav7,
.sub-nav8 {
display: none;
margin: 0;
padding: 0;
list-style: none;
}
.sub-nav li,
.sub-nav2 li,
.sub-nav3 li,
.sub-nav4 li,
.sub-nav5 li,
.sub-nav6 li,
.sub-nav7 li,
.sub-nav8 li {
font-size: 14px;
color: #fff;
list-style: none;
padding: 8px 15px 8px 30px;
}
#sidebarCollapse-mobile {
display: none;
background-color: transparent;
border: none;
font-size: 28px;
color: #fff;
vertical-align: middle;
margin-right: 25px;
outline: none;
cursor: pointer;
}
@media (max-width: 767px) {
#sidebar {
min-width: 0px;
max-width: 0px;
text-align: center;
}
#sidebar.collapse-sidebar {
min-width: 250px;
max-width: 250px;
text-align: left;
z-index: 1;
}
#sidebar .sidebar-header img {
width: 40px;
}
#sidebar.collapse-sidebar .sidebar-header img {
width: 100px;
}
#sidebar ul.list-unstyled li a {
height: 60px;
padding: 20px 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a {
height: 40px;
padding: 8px 25px;
}
#sidebar ul.list-unstyled li a i {
font-size: 18px;
width: 20px;
margin-right: 0;
}
#sidebar.collapse-sidebar ul.list-unstyled li a i {
font-size: 16px;
width: 18px;
margin-right: 15px;
}
#sidebar ul.list-unstyled li:first-child a i {
font-size: 20px;
}
#sidebar.collapse-sidebar ul.list-unstyled li:first-child a i {
font-size: 18px;
}
#sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: none;
}
#sidebar.collapse-sidebar ul.list-unstyled li a span.sidebar-menu-text {
display: inline-block;
}
*#layout-admin {
-webkit-transform: translate3d(0px, 0, 0);
transform: translate3d(0px, 0, 0);
width: calc(100% - 0px);
}
#layout-admin.collapse-sidebar {
width: calc(100% - 0px);
transform: translate3d(0px, 0, 0);
-webkit-transform: translate3d(0px, 0, 0);
-moz-transform: translate3d(0px, 0, 0);
-ms-transform: translate3d(0px, 0, 0);
-o-transform: translate3d(0px, 0, 0);
}
#layout-admin .header .header-left .title {
font-size: 16px;
}
#layout-admin .header .header-right a {
font-size: 22px;
}
#username {
font-size: 14px;
}
#sidebar.collapse-sidebar #sidebarCollapse-mobile {
display: inline-block;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<script
src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</head>
<body>
<nav id="sidebar">
<!--------------------- Sidebar header ---------------------------->
<div class="sidebar-header">
<a href="#"><img src="/common/images/logo.svg" alt="logo"></a>
<button type="button" id="sidebarCollapse-mobile" class="show-sidebar">
<i class="fa fa-bars"></i>
</button>
</div>
<!--------------------- Sidebar menu ---------------------------->
<ul class="list-unstyled nav-links">
<li class="active">
<a href="#">
<i class="fa fa-home" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Home</span>
</a>
</li>
<li id="li-pendingorders">
<a href="javascript:void(0)" class="has-sub">
<i class="fas fa-box-open" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Pending Orders</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-collectorders" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-crosshairs"></span> Collect orders</a>
</li>
<li id="li-addneworder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-box-open"></span> Partial collect</a>
</li>
<li id="li-warehousecollect" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-warehouse"></span> Warehouse collect</a>
</li>
<li id="li-outofstock" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-surprise"></span> Out of Stock</a>
</li>
<li id="li-ordered" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-thumbtack "></span> Ordered</a>
</li>
<li id="li-rts" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-recycle"></span> RTS</a>
</li>
<li id="li-awaitinglist" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-pause-circle"></span> Awaiting List</a>
</li>
</ul>
</li>
<li id="li-manageorders">
<a href="javascript:void(0)" class="has-sub">
<i class="fa fa-tasks" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Manage Orders</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-addneworder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-eye"></span> View Order</a>
</li>
<li id="li-warehousecollect" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-plus"></span> Create Order</a>
</li>
</ul>
</li>
<li id="li-packorders">
<a href="javascript:void(0)" class="has-sub">
<i class="fa fa-tape" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Pack Orders</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tape"></span> Pack Orders</a>
</li>
</ul>
</li>
<li id="li-manageinventory">
<a href="javascript:void(0)" class="has-sub">
<i class="fa fa-table" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Manage Inventory</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-sliders-h"></span> Adjust Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-truck-loading"></span> Receive Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-dolly"></span> Ship Stock</a>
</li>
<li id="li-packorder" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-map-marked-alt"></span> Locations</a>
</li>
</ul>
</li>
<li id="li-orderdownload">
<a href="#">
<i class="fa fa-download" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Download Orders</span>
</a>
</li>
<li id="li-tracking">
<a href="javascript:void(0)" class="has-sub">
<i class="fas fa-shipping-fast" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Tracking</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-markorderassent" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-truck"></span> Mark Order as Sent</a>
</li>
<li id="li-downloatrackings" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-arrow-down"></span> Download Trackings</a>
</li>
<li id="li-uploadtrackings" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-arrow-up"></span> Upload Trackings</a>
</li>
</ul>
</li>
<li id="labels">
<a href="javascript:void(0)" class="has-sub">
<i class="fas fa-tags"></i>
<span class='sidebar-menu-text'>Labels</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-createlabels" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tag"></span> Create Labels</a>
</li>
<li id="li-morelabels" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-tags"></span> More Labels (template)</a>
</li>
</ul>
</li>
<li id="refunds">
<a href="#">
<i class="fas fa-money-bill-wave"></i>
<span class='sidebar-menu-text'>Refunds</span>
</a>
</li>
<li id="manageadm">
<a href="javascript:void(0)" class="has-sub">
<i class="fas fa-users-cog" aria-hidden="true"></i>
<span class='sidebar-menu-text'>Admin</span>
</a>
<ul class="sub-nav" style="display: none;">
<li id="li-usermanagement" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-user-cog"></span> User Management</a>
</li>
<li id="li-packermanagement" style="margin-top: 0px;margin-bottom: 0px;">
<a style="height: 30px;padding-top: 5px;padding-left: 15px;" href="#"><span class="fas fa-toolbox"></span> Packer Management</a>
</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>