我正在创建一个导航栏,如下所示。
我想实现的主要功能有:
我的问题是:
感谢您的帮助!:)
$(".burger-btn-wrapper").click(function() {
$(".main-sidebar").toggleClass("main-sidebar-view");
});
.container {
height: 768px;
}
.navbar {
display: block;
width: 100%;
position: relative;
margin-bottom: 640px;
color: #333;
background-color: #fff;
}
.navbar-logo-wrapper {
position: absolute;
height: 60px;
width: 100%;
top: 0;
left: 0;
text-align: center;
z-index: 999;
}
.navbar-logo-wrapper img {
width: 32px;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-top {
width: 100%;
height: 60px;
box-shadow: 0px 1px 8px 0 rgba(0,0,0,0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 32px;
box-sizing: border-box;
position: relative;
background-color: #fff;
}
.navbar-top-left {
z-index: 999;
}
.burger-btn-wrapper {
display: inline-block;
text-align: center;
margin: 0 16px 0 0;
}
.burger-btn-wrapper i {
font-size: 16px;
color: #333;
line-height: 60px;
transform: translateY(1px);
}
.module-name {
height: 60px;
line-height: 60px;
text-transform: uppercase;
display: inline-block;
font-size: 13px;
font-weight: 700;
color: #333;
}
.navbar-top-right {
z-index: 999;
}
.navbar-top-middle {
height: 60px;
text-align: center;
position: relative;
line-height: 0;
}
.modules-icon {
vertical-align: middle;
display: inline-block;
width: 60px;
text-align: center;
}
.modules-icon i {
font-size: 16px;
color: #333;
line-height: 60px;
}
.navbar-profile {
display: inline-block;
vertical-align: middle;
line-height: 0;
cursor: pointer;
}
.navbar-profile img {
vertical-align: top;
}
.profpic-wrapper {
display: inline-block;
vertical-align: middle;
width: 60px;
height: 60px;
cursor: pointer;
}
.navbar-profpic {
width: 40px;
height: 40px;
background-color: #00c983;
border-radius: 40px;
position: relative;
margin-left: 10px;
margin-top: 10px;
}
.profile-initial {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
}
.profile-name {
display: inline-block;
vertical-align: middle;
font-size: 13px;
}
.profile-dropdown-icon {
vertical-align: middle;
display: inline-block;
margin-left: 8px;
}
.profile-dropdown-icon i {
font-size: 10px;
}
.navbar-wrapper {
display: inline-block;
width: 100%;
}
.navbar-top-middle img {
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-menu {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.navbar-menu-list {
width: 750px;
list-style-type: none;
margin: 0;
padding: 15px 0;
cursor: pointer;
z-index: -1;
margin-left: 0;
}
.navbar-menu-each {
padding-left: 32px;
padding-right: 32px;
display: inline-block;
position: relative;
}
.navbar-menu-each:first-child {
padding-left: 32px;
}
.navbar-menu-each a {
color: #333;
font-size: 13px;
text-decoration: none;
}
.menu-on a {
font-weight: 700;
color: #00c983;
}
.navbar-page-name {
display: block;
font-size: 22px;
height: 60px;
line-height: 60px;
border-top: solid 0.5px #DEF5ED;
border-bottom: solid 0.5px #DEF5ED;
background-color: #F0FBF7;
color: #333;
padding-left: 32px;
}
.navbar-menu::-webkit-scrollbar {
height: 0;
}
.navbar-menu::-webkit-scrollbar-thumb {
background-color: transparent;
}
.profile-dropdown {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
position: absolute;
cursor: pointer;
top: 106px;
}
.submenu-dropdown {
display: none;
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.15);
cursor: pointer;
position: absolute;
top: 20px;
left:0;
border: solid 1px #000;
}
.navbar-menu-each:hover > .submenu-dropdown,
.submenu-dropdown:hover {
display: block;
}
.submenu-dropdown-each {
display: block;
line-height: 48px;
font-size: 13px;
color: #333;
width: auto;
padding: 0 32px 0 24px;
}
.submenu-dropdown-each:hover {
background: #f8f8f8;
}
.submenu-selected {
font-weight: 700;
color: #00c983;
}
.profile-dropdown-check i {
display: none;
}
.profile-dropdown-check i.role-active {
display: inline-block;
color: #00c983;
}
.main-sidebar {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
width: 240px;
font-size: 13px;
color: #333;
position: absolute;
top: 51px;
left: -260px;
-webkit-transition: left 0.5s;
transition: left 0.5s;
height: 717px;
}
.main-sidebar-list-wrapper {
height: 669px;
width: 240px;
overflow: auto;
}
.main-sidebar-view {
left: 0;
-webkit-transition: left 0.5s;
transition: left 0.5s;
}
.sidebar-section {
width: 240px;
}
.sidebar-section li {
display: block;
line-height: 48px;
padding-left: 16px;
height: 48px;
}
.sidebar-section-title {
border-bottom: solid 1px #eee;
font-size: 16px;
}
.sidebar-icon {
position: relative;
display: inline-block;
width: 28px;
height: 48px;
}
.sidebar-icon img {
width: 18px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.sidebar-menu {
display: inline-block;
vertical-align: top;
}
.main-sidebar-list-wrapper::-webkit-scrollbar {
height: 0;
}
.main-sidebar-list-wrapper::-webkit-scrollbar-thumb {
background-color: transparent;
}
.main-sidebar-footer {
height: 48px;
line-height: 48px;
text-align: center;
border-top: solid 1px #eee;
}
@media (max-width: 767px) and (min-width: 576px) {
.navbar-top {
padding: 0 24px;
}
.navbar-menu-each:first-child {
padding-left: 24px;
}
.navbar-page-name {
padding-left: 24px;
}
.callout {
right: 94px;
}
}
@media (max-width: 575px) {
.module-name {
display: none;
}
.profile-name {
display: none;
}
.modules-icon {
display: none;
}
.navbar-top {
padding: 0 16px;
}
.navbar-menu-each:first-child {
padding-left: 16px;
}
.navbar-page-name {
padding-left: 16px;
}
.profile-dropdown-icon {
margin-left: 0;
}
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i" rel="stylesheet">
<div class="container">
<div class="navbar">
<div class="main-sidebar">
<div class="main-sidebar-list-wrapper">
<ul class="sidebar-section">
<li class="sidebar-section-title">Organization</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/LZ44Z0dPvtn2OCGT02lwNZuaUK76Zw69uaYSF4sTe63PtTpKS4IiUM7LjsV5VvlH1hsB6bZM4rA8g9fVsYgUzg/192"></span>
<span class="sidebar-menu">Company</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/8pNCxwrs9k-2fnR6iCzgQ-FEhutp_EcFTTfb9jD207NZSwBU98yuTSPZAKwsh7muBJKKG-MBcsgoqbEpXnZLnQ/213"></span>
<span class="sidebar-menu">Employee</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/mE5M0CywlR63kvqGKenpBEdDFYpOnpHB02javJrGr8r0gJGl_-vuUnKJJpWe6pZChsjIq1yXUgofhicw7MvFCw/177"></span>
<span class="sidebar-menu">Termination</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Compensation & Benefits</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/vYgvWe324-eiGFdWDNoBi7WrWHUAFhEbZCoLWve5NE2rBrFrGmK7ZLjW3W0ggCHce1BCyY6FFTzxRm-Fg9VmBA/168"></span>
<span class="sidebar-menu">BPJS Ketenagakerjaan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/bVKXdl3sBeP8-w1wTrEapdUOlcJFSPi4_koRbRVtzL2NR8N-BPZdJUdpPWjSXC13Um6GLbt5DO1DV2t_j7hQDw/168"></span>
<span class="sidebar-menu">BPJS Kesehatan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/TaVNZzoRbkdvziFtWEyv4sEVQMnVVteQt2CB9aCU4xyOdTaCTDAqL9mqUA-3nGmdJZ7qzLZbxXr2xfXjlVDpDg/173"></span>
<span class="sidebar-menu">Payroll</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/NAZCBsbI_bURxMPsr3N05H2_d8KSiz_RtfaMqHp8Tg8tKFEb4RN-5aHgFQiz0y05Ik4BAD8RMRb5LC-Ufg35zA/175"></span>
<span class="sidebar-menu">PPh 21</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Admin Panel</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/FNTOwLJTLz1ndzUxgINBH_tCYJgn7rp-HvtVlpTSN1RQ1yuy1q7UskqQikaey0uHl2Fu7C-rXOgaw_VsGH82Lg/136"></span>
<span class="sidebar-menu">User Management</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/DLaWkbWQ4jxYfEVNpCKBxOyS8G1mzuN24jzbf62tvMsYRvMD0zob2s2K1mBCj62YTYM_MaQmJlt6KmS0WY2uwA/159"></span>
<span class="sidebar-menu">Master Data</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/h2z5yDkjFcZ5OwhHWcI6VrhUL9Yj-u43QPEjlo7XyHE2pR-ghxrJdXw8mfB5C89AzEd403gqfCrd2JAUMbJ1xQ/199"></span>
<span class="sidebar-menu">Log</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/cn4XSK1tZu9KoSq5Q7iQXAMWcqjw5JolDHCvP52UD2wvu2brkBoit1F7SDUJmFVChGbo1LthZixKzx5ee3jJsQ/156"></span>
<span class="sidebar-menu">Data Migration</span>
</li>
</ul>
</div>
<div class="main-sidebar-footer">
© CATAPA 2017
</div>
</div>
<div class="navbar-logo-wrapper">
<img class="navbar-tree" src="https://cdn.frontify.com/api/screen/thumbnail/7UV_lfX5OBfHxFn5lc3ygK8UTU3z5pivwY9QDSDIOiFemj-DdmDzmwiPvbibaG63IMXz-MmGOs4aH-UqgoT9gw/350">
</div>
<div class="navbar-top">
<div class="navbar-top-left">
<div class="burger-btn-wrapper">
<i class="fas fa-bars"></i>
</div>
<div class="module-name">Employee</div>
</div>
<div class="navbar-top-right">
<div class="modules-icon"><i class="fas fa-th"></i></div>
<div class="navbar-profile">
<div class="profpic-wrapper">
<div class="navbar-profpic">
<div class="profile-initial">DJ</div>
</div>
</div>
<div class="profile-name">Dennis Jonathan</div>
<div class="profile-dropdown-icon"><i class="fas fa-chevron-down"></i></div>
</div>
</div>
</div>
<div class="navbar-menu">
<ul class="navbar-menu-list">
<li class="navbar-menu-each">
<a href="#">Employee Directory</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>New Employee Registration</li>
<li class='submenu-dropdown-each submenu-selected'>Employee List</li>
<li class='submenu-dropdown-each'>Employee Rehire</li>
<li class='submenu-dropdown-each'>Employee Without Bank Account</li>
<li class='submenu-dropdown-each'>Employee Without PPh 21</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Memo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Memo Template</li>
<li class='submenu-dropdown-each'>Print Memo</li>
</ul>
</li>
<li class="navbar-menu-each"><a href="#">Bulk Update</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Download & Upload</li>
<li class='submenu-dropdown-each'>Send Email</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Approvals and Undo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Approvals</li>
<li class='submenu-dropdown-each'>Employment Status Undo</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Report</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Report</li>
<li class='submenu-dropdown-each'>Headcount Report</li>
<li class='submenu-dropdown-each'>Employee Recapitulation Report</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-page-name">
Employee List
</div>
</div>
<div class="cover-top"></div>
<div class="cover-left"></div>
<div class="cover-right"></div>
<div class="cover-bottom"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
我改变了:
.main-sidebar { z-index: 10; }
.navbar-top { z-index: 11; }
.navbar-logo { z-index: 11; }
$(".burger-btn-wrapper").click(function() {
$(".main-sidebar").toggleClass("main-sidebar-view");
$(".submenu-dropdown").hide();
});
.container {
height: 768px;
}
.cover-top {
border-top: solid 12px #fff;
position: absolute;
top: -4px;
left: 0;
width: 100%;
height: 0;
}
.cover-left {
border-left: solid 12px #fff;
position: absolute;
left: -4px;
top: 0;
width: 0;
height: 100%;
}
.cover-right {
border-right: solid 12px #fff;
position: absolute;
top: 0;
right: -4px;
width: 0;
height: 100%;
}
.cover-bottom {
border-bottom: solid 12px #fff;
position: absolute;
top: 772px;
left: 0;
width: 100%;
height: 0;
}
.navbar {
display: block;
width: 100%;
position: relative;
margin-bottom: 640px;
color: #333;
background-color: #fff;
}
.navbar-logo-wrapper {
position: absolute;
height: 60px;
width: 100%;
top: 0;
left: 0;
text-align: center;
z-index: 11;
}
.navbar-logo-wrapper img {
width: 32px;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-top {
width: 100%;
height: 60px;
box-shadow: 0px 1px 8px 0 rgba(0,0,0,0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 32px;
box-sizing: border-box;
position: relative;
background-color: #fff;
z-index: 11;
}
.navbar-top-left {
z-index: 999;
}
.burger-btn-wrapper {
display: inline-block;
text-align: center;
margin: 0 16px 0 0;
}
.burger-btn-wrapper i {
font-size: 16px;
color: #333;
line-height: 60px;
transform: translateY(1px);
}
.module-name {
height: 60px;
line-height: 60px;
text-transform: uppercase;
display: inline-block;
font-size: 13px;
font-weight: 700;
color: #333;
}
.navbar-top-right {
z-index: 999;
}
.navbar-top-middle {
height: 60px;
text-align: center;
position: relative;
line-height: 0;
}
.modules-icon {
vertical-align: middle;
display: inline-block;
width: 60px;
text-align: center;
}
.modules-icon i {
font-size: 16px;
color: #333;
line-height: 60px;
}
.navbar-profile {
display: inline-block;
vertical-align: middle;
line-height: 0;
cursor: pointer;
}
.navbar-profile img {
vertical-align: top;
}
.profpic-wrapper {
display: inline-block;
vertical-align: middle;
width: 60px;
height: 60px;
cursor: pointer;
}
.navbar-profpic {
width: 40px;
height: 40px;
background-color: #00c983;
border-radius: 40px;
position: relative;
margin-left: 10px;
margin-top: 10px;
}
.profile-initial {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
}
.profile-name {
display: inline-block;
vertical-align: middle;
font-size: 13px;
}
.profile-dropdown-icon {
vertical-align: middle;
display: inline-block;
margin-left: 8px;
}
.profile-dropdown-icon i {
font-size: 10px;
}
.navbar-wrapper {
display: inline-block;
width: 100%;
}
.navbar-top-middle img {
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-menu {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.navbar-menu-list {
width: 750px;
list-style-type: none;
margin: 0;
padding: 15px 0;
cursor: pointer;
z-index: -1;
margin-left: 0;
}
.navbar-menu-each {
padding-left: 32px;
padding-right: 32px;
display: inline-block;
position: relative;
}
.navbar-menu-each:first-child {
padding-left: 32px;
}
.navbar-menu-each a {
color: #333;
font-size: 13px;
text-decoration: none;
}
.menu-on a {
font-weight: 700;
color: #00c983;
}
.navbar-page-name {
display: block;
font-size: 22px;
height: 60px;
line-height: 60px;
border-top: solid 0.5px #DEF5ED;
border-bottom: solid 0.5px #DEF5ED;
background-color: #F0FBF7;
color: #333;
padding-left: 32px;
}
.navbar-menu::-webkit-scrollbar {
height: 0;
}
.navbar-menu::-webkit-scrollbar-thumb {
background-color: transparent;
}
.profile-dropdown {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
position: absolute;
cursor: pointer;
top: 106px;
}
.submenu-dropdown {
display: none;
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.15);
cursor: pointer;
position: absolute;
top: 20px;
left:0;
}
.navbar-menu-each:hover > .submenu-dropdown,
.submenu-dropdown:hover {
display: block;
}
.submenu-dropdown-each {
display: block;
line-height: 48px;
font-size: 13px;
color: #333;
width: auto;
padding: 0 32px 0 24px;
}
.submenu-dropdown-each:hover {
background: #f8f8f8;
}
.submenu-selected {
font-weight: 700;
color: #00c983;
}
.profile-dropdown {
padding-top: 8px;
width: 208px;
top: 53px;
right: 20px;
display: none;
}
.profile-dropdown-each {
display: block;
font-size: 13px;
line-height: 36px;
padding-left: 16px;
}
.profile-dropdown-each-section {
color: #aaa;
text-transform: uppercase;
font-weight: 700;
}
.profile-dropdown-check {
float: right;
margin-right: 16px;
}
.profile-dropdown-each-border-top {
border-top: solid 1px #eee;
}
.switch-language-group {
float: right;
margin-right: 16px;
}
.button-language {
height: 24px;
width: 32px;
border: solid 1px #c4c4c4;
display: inline-block;
line-height: 24px;
text-align: center;
}
.button-language-left {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
transform: translateX(4px);
}
.button-language-right {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.button-language-active {
background-color: #00c983;
color: #fff;
border: solid 1px #00c983;
}
.profile-dropdown-check i {
display: none;
}
.profile-dropdown-check i.role-active {
display: inline-block;
color: #00c983;
}
.callout {
width: 260px;
float: left;
background-color: #fff;
position: relative;
color: #333;
font-size: 13px;
margin: 25px;
min-height: 50px;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
position: absolute;
right: 102px;
top: 32px;
z-index: 999;
display: none;
}
.callout::before {
content: "";
width: 0px;
height: 0px;
border: 0.8em solid transparent;
position: absolute;
}
.callout.bottom::before {
left: 45%;
top: -20px;
border-bottom: 10px solid #f8f8f8;
}
.callout-title {
background-color: #f8f8f8;
line-height: 32px;
border-bottom: solid 1px #eee;
padding-left: 16px;
}
.callout-content {
display: block;
padding: 16px;
}
.callout-row {
display: block;
width: 100%;
}
.navbar-module-wrapper {
display: inline-block;
width: 49%;
vertical-align: middle;
text-align: center;
height: 100px;
padding-top: 8px;
padding-bottom: 8px;
cursor: pointer;
border-radius: 3px;
}
.navbar-module-wrapper:hover {
background: #f8f8f8;
}
.navbar-module-wrapper-left {
}
.navbar-module-icon {
width: 48px;
padding: 16px 16px 8px 16px;
}
.caption-basic {
transform: translateY(8px);
}
.icon-tm {
width: 44px;
transform: translateY(-4px);
}
.caption-tm {
transform: translateY(-8px);
}
.icon-recr {
width: 46px;
}
.caption-recr {
transform: translateY(4px);
}
.icon-talent {
width: 38px;
transform: translateY(-2px);
}
.caption-talent {
transform: translateY(-6px);
}
.icon-bm {
width: 50px;
}
.caption-bm {
transform: translateY(-4px);
}
.navbar-module-name {
line-height: 16px;
vertical-align: middle;
height: 60px;
}
.main-sidebar {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
width: 240px;
font-size: 13px;
color: #333;
position: absolute;
top: 51px;
left: -260px;
-webkit-transition: left 0.5s;
transition: left 0.5s;
height: 717px;
z-index: 10;
}
.main-sidebar-list-wrapper {
height: 669px;
width: 240px;
overflow: auto;
}
.main-sidebar-view {
left: 0;
-webkit-transition: left 0.5s;
transition: left 0.5s;
}
.sidebar-section {
width: 240px;
}
.sidebar-section li {
display: block;
line-height: 48px;
padding-left: 16px;
height: 48px;
}
.sidebar-section-title {
border-bottom: solid 1px #eee;
font-size: 16px;
}
.sidebar-icon {
position: relative;
display: inline-block;
width: 28px;
height: 48px;
}
.sidebar-icon img {
width: 18px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.sidebar-menu {
display: inline-block;
vertical-align: top;
}
.main-sidebar-list-wrapper::-webkit-scrollbar {
height: 0;
}
.main-sidebar-list-wrapper::-webkit-scrollbar-thumb {
background-color: transparent;
}
.main-sidebar-footer {
height: 48px;
line-height: 48px;
text-align: center;
border-top: solid 1px #eee;
}
@media (max-width: 767px) and (min-width: 576px) {
.navbar-top {
padding: 0 24px;
}
.navbar-menu-each:first-child {
padding-left: 24px;
}
.navbar-page-name {
padding-left: 24px;
}
.callout {
right: 94px;
}
}
@media (max-width: 575px) {
.module-name {
display: none;
}
.profile-name {
display: none;
}
.modules-icon {
display: none;
}
.navbar-top {
padding: 0 16px;
}
.navbar-menu-each:first-child {
padding-left: 16px;
}
.navbar-page-name {
padding-left: 16px;
}
.profile-dropdown-icon {
margin-left: 0;
}
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i" rel="stylesheet">
<div class="container">
<div class="navbar">
<div class="main-sidebar">
<div class="main-sidebar-list-wrapper">
<ul class="sidebar-section">
<li class="sidebar-section-title">Organization</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/LZ44Z0dPvtn2OCGT02lwNZuaUK76Zw69uaYSF4sTe63PtTpKS4IiUM7LjsV5VvlH1hsB6bZM4rA8g9fVsYgUzg/192"></span>
<span class="sidebar-menu">Company</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/8pNCxwrs9k-2fnR6iCzgQ-FEhutp_EcFTTfb9jD207NZSwBU98yuTSPZAKwsh7muBJKKG-MBcsgoqbEpXnZLnQ/213"></span>
<span class="sidebar-menu">Employee</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/mE5M0CywlR63kvqGKenpBEdDFYpOnpHB02javJrGr8r0gJGl_-vuUnKJJpWe6pZChsjIq1yXUgofhicw7MvFCw/177"></span>
<span class="sidebar-menu">Termination</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Compensation & Benefits</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/vYgvWe324-eiGFdWDNoBi7WrWHUAFhEbZCoLWve5NE2rBrFrGmK7ZLjW3W0ggCHce1BCyY6FFTzxRm-Fg9VmBA/168"></span>
<span class="sidebar-menu">BPJS Ketenagakerjaan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/bVKXdl3sBeP8-w1wTrEapdUOlcJFSPi4_koRbRVtzL2NR8N-BPZdJUdpPWjSXC13Um6GLbt5DO1DV2t_j7hQDw/168"></span>
<span class="sidebar-menu">BPJS Kesehatan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/TaVNZzoRbkdvziFtWEyv4sEVQMnVVteQt2CB9aCU4xyOdTaCTDAqL9mqUA-3nGmdJZ7qzLZbxXr2xfXjlVDpDg/173"></span>
<span class="sidebar-menu">Payroll</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/NAZCBsbI_bURxMPsr3N05H2_d8KSiz_RtfaMqHp8Tg8tKFEb4RN-5aHgFQiz0y05Ik4BAD8RMRb5LC-Ufg35zA/175"></span>
<span class="sidebar-menu">PPh 21</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Admin Panel</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/FNTOwLJTLz1ndzUxgINBH_tCYJgn7rp-HvtVlpTSN1RQ1yuy1q7UskqQikaey0uHl2Fu7C-rXOgaw_VsGH82Lg/136"></span>
<span class="sidebar-menu">User Management</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/DLaWkbWQ4jxYfEVNpCKBxOyS8G1mzuN24jzbf62tvMsYRvMD0zob2s2K1mBCj62YTYM_MaQmJlt6KmS0WY2uwA/159"></span>
<span class="sidebar-menu">Master Data</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/h2z5yDkjFcZ5OwhHWcI6VrhUL9Yj-u43QPEjlo7XyHE2pR-ghxrJdXw8mfB5C89AzEd403gqfCrd2JAUMbJ1xQ/199"></span>
<span class="sidebar-menu">Log</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/cn4XSK1tZu9KoSq5Q7iQXAMWcqjw5JolDHCvP52UD2wvu2brkBoit1F7SDUJmFVChGbo1LthZixKzx5ee3jJsQ/156"></span>
<span class="sidebar-menu">Data Migration</span>
</li>
</ul>
</div>
<div class="main-sidebar-footer">
© CATAPA 2017
</div>
</div>
<div class="navbar-logo-wrapper">
<img class="navbar-tree" src="https://cdn.frontify.com/api/screen/thumbnail/7UV_lfX5OBfHxFn5lc3ygK8UTU3z5pivwY9QDSDIOiFemj-DdmDzmwiPvbibaG63IMXz-MmGOs4aH-UqgoT9gw/350">
</div>
<div class="navbar-top">
<div class="navbar-top-left">
<div class="burger-btn-wrapper">
<i class="fas fa-bars"></i>
</div>
<div class="module-name">Employee</div>
</div>
<div class="navbar-top-right">
<div class="modules-icon"><i class="fas fa-th"></i></div>
<div class="navbar-profile">
<div class="profpic-wrapper">
<div class="navbar-profpic">
<div class="profile-initial">DJ</div>
</div>
</div>
<div class="profile-name">Dennis Jonathan</div>
<div class="profile-dropdown-icon"><i class="fas fa-chevron-down"></i></div>
</div>
</div>
</div>
<div class="navbar-menu">
<ul class="navbar-menu-list">
<li class="navbar-menu-each">
<a href="#">Employee Directory</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>New Employee Registration</li>
<li class='submenu-dropdown-each submenu-selected'>Employee List</li>
<li class='submenu-dropdown-each'>Employee Rehire</li>
<li class='submenu-dropdown-each'>Employee Without Bank Account</li>
<li class='submenu-dropdown-each'>Employee Without PPh 21</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Memo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Memo Template</li>
<li class='submenu-dropdown-each'>Print Memo</li>
</ul>
</li>
<li class="navbar-menu-each"><a href="#">Bulk Update</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Download & Upload</li>
<li class='submenu-dropdown-each'>Send Email</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Approvals and Undo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Approvals</li>
<li class='submenu-dropdown-each'>Employment Status Undo</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Report</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Report</li>
<li class='submenu-dropdown-each'>Headcount Report</li>
<li class='submenu-dropdown-each'>Employee Recapitulation Report</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-page-name">
Employee List
</div>
</div>
<div class="cover-top"></div>
<div class="cover-left"></div>
<div class="cover-right"></div>
<div class="cover-bottom"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
根据您在评论中提到的第一个问题,您希望侧边栏位于第一行后面。看z-index
作为每个堆栈
属性工作,所以在堆栈顶部的元素将服务于其他元素。假设如果elementA
有一个默认的z-index: 0
,你给的另一个elementB
z-index: 1将在堆栈的顶部,然后elementA将被提供。
在您的情况下,您希望在第一行nav
后面有sidebar
。
.main-sidebar{
z-index: -1; // This will lower the stack order compair to zero index elements
}
请看一下代码段,但侧边栏现在已经包含了所有内容,所以您需要根据需要对其进行定位。
现在,这将在每个元素后面使用,除非任何元素堆栈顺序低于
您的第二个问题是它不可见或工作似乎像一些js问题,或者您错过了添加一些js,使悬停选项启用。更新它,我将尝试修复它。
$(".burger-btn-wrapper").click(function() {
$(".main-sidebar").toggleClass("main-sidebar-view");
$(".submenu-dropdown").hide();
});
.container {
height: 768px;
}
.main-sidebar{
z-index : -1;
top : 100%;
}
.navbar {
display: block;
width: 100%;
position: relative;
margin-bottom: 640px;
color: #333;
background-color: #fff;
}
.navbar-logo-wrapper {
position: absolute;
height: 60px;
width: 100%;
top: 0;
left: 0;
text-align: center;
z-index: 999;
}
.navbar-logo-wrapper img {
width: 32px;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-top {
width: 100%;
height: 60px;
box-shadow: 0px 1px 8px 0 rgba(0,0,0,0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 32px;
box-sizing: border-box;
position: relative;
background-color: #fff;
}
.navbar-top-left {
z-index: 999;
}
.burger-btn-wrapper {
display: inline-block;
text-align: center;
margin: 0 16px 0 0;
}
.burger-btn-wrapper i {
font-size: 16px;
color: #333;
line-height: 60px;
transform: translateY(1px);
}
.module-name {
height: 60px;
line-height: 60px;
text-transform: uppercase;
display: inline-block;
font-size: 13px;
font-weight: 700;
color: #333;
}
.navbar-top-right {
z-index: 999;
}
.navbar-top-middle {
height: 60px;
text-align: center;
position: relative;
line-height: 0;
}
.modules-icon {
vertical-align: middle;
display: inline-block;
width: 60px;
text-align: center;
}
.modules-icon i {
font-size: 16px;
color: #333;
line-height: 60px;
}
.navbar-profile {
display: inline-block;
vertical-align: middle;
line-height: 0;
cursor: pointer;
}
.navbar-profile img {
vertical-align: top;
}
.profpic-wrapper {
display: inline-block;
vertical-align: middle;
width: 60px;
height: 60px;
cursor: pointer;
}
.navbar-profpic {
width: 40px;
height: 40px;
background-color: #00c983;
border-radius: 40px;
position: relative;
margin-left: 10px;
margin-top: 10px;
}
.profile-initial {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
}
.profile-name {
display: inline-block;
vertical-align: middle;
font-size: 13px;
}
.profile-dropdown-icon {
vertical-align: middle;
display: inline-block;
margin-left: 8px;
}
.profile-dropdown-icon i {
font-size: 10px;
}
.navbar-wrapper {
display: inline-block;
width: 100%;
}
.navbar-top-middle img {
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-menu {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.navbar-menu-list {
width: 750px;
list-style-type: none;
margin: 0;
padding: 15px 0;
cursor: pointer;
z-index: -1;
margin-left: 0;
}
.navbar-menu-each {
padding-left: 32px;
padding-right: 32px;
display: inline-block;
position: relative;
}
.navbar-menu-each:first-child {
padding-left: 32px;
}
.navbar-menu-each a {
color: #333;
font-size: 13px;
text-decoration: none;
}
.menu-on a {
font-weight: 700;
color: #00c983;
}
.navbar-page-name {
display: block;
font-size: 22px;
height: 60px;
line-height: 60px;
border-top: solid 0.5px #DEF5ED;
border-bottom: solid 0.5px #DEF5ED;
background-color: #F0FBF7;
color: #333;
padding-left: 32px;
}
.navbar-menu::-webkit-scrollbar {
height: 0;
}
.navbar-menu::-webkit-scrollbar-thumb {
background-color: transparent;
}
.profile-dropdown {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
position: absolute;
cursor: pointer;
top: 106px;
}
.submenu-dropdown {
display: none;
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.15);
cursor: pointer;
position: absolute;
top: 20px;
left:0;
}
.navbar-menu-each:hover > .submenu-dropdown,
.submenu-dropdown:hover {
display: block;
}
.submenu-dropdown-each {
display: block;
line-height: 48px;
font-size: 13px;
color: #333;
width: auto;
padding: 0 32px 0 24px;
}
.submenu-dropdown-each:hover {
background: #f8f8f8;
}
.submenu-selected {
font-weight: 700;
color: #00c983;
}
.profile-dropdown {
padding-top: 8px;
width: 208px;
top: 53px;
right: 20px;
display: none;
}
.profile-dropdown-each {
display: block;
font-size: 13px;
line-height: 36px;
padding-left: 16px;
}
.profile-dropdown-each-section {
color: #aaa;
text-transform: uppercase;
font-weight: 700;
}
.profile-dropdown-check {
float: right;
margin-right: 16px;
}
.profile-dropdown-each-border-top {
border-top: solid 1px #eee;
}
.switch-language-group {
float: right;
margin-right: 16px;
}
.button-language {
height: 24px;
width: 32px;
border: solid 1px #c4c4c4;
display: inline-block;
line-height: 24px;
text-align: center;
}
.button-language-left {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
transform: translateX(4px);
}
.button-language-right {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.button-language-active {
background-color: #00c983;
color: #fff;
border: solid 1px #00c983;
}
.profile-dropdown-check i {
display: none;
}
.profile-dropdown-check i.role-active {
display: inline-block;
color: #00c983;
}
.navbar-module-wrapper {
display: inline-block;
width: 49%;
vertical-align: middle;
text-align: center;
height: 100px;
padding-top: 8px;
padding-bottom: 8px;
cursor: pointer;
border-radius: 3px;
}
.navbar-module-wrapper:hover {
background: #f8f8f8;
}
.navbar-module-wrapper-left {
}
.navbar-module-icon {
width: 48px;
padding: 16px 16px 8px 16px;
}
.caption-basic {
transform: translateY(8px);
}
.icon-tm {
width: 44px;
transform: translateY(-4px);
}
.caption-tm {
transform: translateY(-8px);
}
.icon-recr {
width: 46px;
}
.caption-recr {
transform: translateY(4px);
}
.icon-talent {
width: 38px;
transform: translateY(-2px);
}
.caption-talent {
transform: translateY(-6px);
}
.icon-bm {
width: 50px;
}
.caption-bm {
transform: translateY(-4px);
}
.navbar-module-name {
line-height: 16px;
vertical-align: middle;
height: 60px;
}
.main-sidebar {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
width: 240px;
font-size: 13px;
color: #333;
position: absolute;
top: 51px;
left: -260px;
-webkit-transition: left 0.5s;
transition: left 0.5s;
height: 717px;
}
.main-sidebar-list-wrapper {
height: 669px;
width: 240px;
overflow: auto;
}
.main-sidebar-view {
left: 0;
-webkit-transition: left 0.5s;
transition: left 0.5s;
}
.sidebar-section {
width: 240px;
}
.sidebar-section li {
display: block;
line-height: 48px;
padding-left: 16px;
height: 48px;
}
.sidebar-section-title {
border-bottom: solid 1px #eee;
font-size: 16px;
}
.sidebar-icon {
position: relative;
display: inline-block;
width: 28px;
height: 48px;
}
.sidebar-icon img {
width: 18px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.sidebar-menu {
display: inline-block;
vertical-align: top;
}
.main-sidebar-list-wrapper::-webkit-scrollbar {
height: 0;
}
.main-sidebar-list-wrapper::-webkit-scrollbar-thumb {
background-color: transparent;
}
.main-sidebar-footer {
height: 48px;
line-height: 48px;
text-align: center;
border-top: solid 1px #eee;
}
@media (max-width: 767px) and (min-width: 576px) {
.navbar-top {
padding: 0 24px;
}
.navbar-menu-each:first-child {
padding-left: 24px;
}
.navbar-page-name {
padding-left: 24px;
}
.callout {
right: 94px;
}
}
@media (max-width: 575px) {
.module-name {
display: none;
}
.profile-name {
display: none;
}
.modules-icon {
display: none;
}
.navbar-top {
padding: 0 16px;
}
.navbar-menu-each:first-child {
padding-left: 16px;
}
.navbar-page-name {
padding-left: 16px;
}
.profile-dropdown-icon {
margin-left: 0;
}
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i" rel="stylesheet">
<div class="container">
<div class="navbar">
<div class="main-sidebar">
<div class="main-sidebar-list-wrapper">
<ul class="sidebar-section">
<li class="sidebar-section-title">Organization</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/LZ44Z0dPvtn2OCGT02lwNZuaUK76Zw69uaYSF4sTe63PtTpKS4IiUM7LjsV5VvlH1hsB6bZM4rA8g9fVsYgUzg/192"></span>
<span class="sidebar-menu">Company</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/8pNCxwrs9k-2fnR6iCzgQ-FEhutp_EcFTTfb9jD207NZSwBU98yuTSPZAKwsh7muBJKKG-MBcsgoqbEpXnZLnQ/213"></span>
<span class="sidebar-menu">Employee</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/mE5M0CywlR63kvqGKenpBEdDFYpOnpHB02javJrGr8r0gJGl_-vuUnKJJpWe6pZChsjIq1yXUgofhicw7MvFCw/177"></span>
<span class="sidebar-menu">Termination</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Compensation & Benefits</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/vYgvWe324-eiGFdWDNoBi7WrWHUAFhEbZCoLWve5NE2rBrFrGmK7ZLjW3W0ggCHce1BCyY6FFTzxRm-Fg9VmBA/168"></span>
<span class="sidebar-menu">BPJS Ketenagakerjaan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/bVKXdl3sBeP8-w1wTrEapdUOlcJFSPi4_koRbRVtzL2NR8N-BPZdJUdpPWjSXC13Um6GLbt5DO1DV2t_j7hQDw/168"></span>
<span class="sidebar-menu">BPJS Kesehatan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/TaVNZzoRbkdvziFtWEyv4sEVQMnVVteQt2CB9aCU4xyOdTaCTDAqL9mqUA-3nGmdJZ7qzLZbxXr2xfXjlVDpDg/173"></span>
<span class="sidebar-menu">Payroll</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/NAZCBsbI_bURxMPsr3N05H2_d8KSiz_RtfaMqHp8Tg8tKFEb4RN-5aHgFQiz0y05Ik4BAD8RMRb5LC-Ufg35zA/175"></span>
<span class="sidebar-menu">PPh 21</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Admin Panel</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/FNTOwLJTLz1ndzUxgINBH_tCYJgn7rp-HvtVlpTSN1RQ1yuy1q7UskqQikaey0uHl2Fu7C-rXOgaw_VsGH82Lg/136"></span>
<span class="sidebar-menu">User Management</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/DLaWkbWQ4jxYfEVNpCKBxOyS8G1mzuN24jzbf62tvMsYRvMD0zob2s2K1mBCj62YTYM_MaQmJlt6KmS0WY2uwA/159"></span>
<span class="sidebar-menu">Master Data</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/h2z5yDkjFcZ5OwhHWcI6VrhUL9Yj-u43QPEjlo7XyHE2pR-ghxrJdXw8mfB5C89AzEd403gqfCrd2JAUMbJ1xQ/199"></span>
<span class="sidebar-menu">Log</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/cn4XSK1tZu9KoSq5Q7iQXAMWcqjw5JolDHCvP52UD2wvu2brkBoit1F7SDUJmFVChGbo1LthZixKzx5ee3jJsQ/156"></span>
<span class="sidebar-menu">Data Migration</span>
</li>
</ul>
</div>
<div class="main-sidebar-footer">
© CATAPA 2017
</div>
</div>
<div class="navbar-logo-wrapper">
<img class="navbar-tree" src="https://cdn.frontify.com/api/screen/thumbnail/7UV_lfX5OBfHxFn5lc3ygK8UTU3z5pivwY9QDSDIOiFemj-DdmDzmwiPvbibaG63IMXz-MmGOs4aH-UqgoT9gw/350">
</div>
<div class="navbar-top">
<div class="navbar-top-left">
<div class="burger-btn-wrapper">
<i class="fas fa-bars"></i>
</div>
<div class="module-name">Employee</div>
</div>
<div class="navbar-top-right">
<div class="modules-icon"><i class="fas fa-th"></i></div>
<div class="navbar-profile">
<div class="profpic-wrapper">
<div class="navbar-profpic">
<div class="profile-initial">DJ</div>
</div>
</div>
<div class="profile-name">Dennis Jonathan</div>
<div class="profile-dropdown-icon"><i class="fas fa-chevron-down"></i></div>
</div>
</div>
</div>
<div class="navbar-menu">
<ul class="navbar-menu-list">
<li class="navbar-menu-each">
<a href="#">Employee Directory</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>New Employee Registration</li>
<li class='submenu-dropdown-each submenu-selected'>Employee List</li>
<li class='submenu-dropdown-each'>Employee Rehire</li>
<li class='submenu-dropdown-each'>Employee Without Bank Account</li>
<li class='submenu-dropdown-each'>Employee Without PPh 21</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Memo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Memo Template</li>
<li class='submenu-dropdown-each'>Print Memo</li>
</ul>
</li>
<li class="navbar-menu-each"><a href="#">Bulk Update</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Download & Upload</li>
<li class='submenu-dropdown-each'>Send Email</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Approvals and Undo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Approvals</li>
<li class='submenu-dropdown-each'>Employment Status Undo</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Report</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Report</li>
<li class='submenu-dropdown-each'>Headcount Report</li>
<li class='submenu-dropdown-each'>Employee Recapitulation Report</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-page-name">
Employee List
</div>
</div>
<div class="cover-top"></div>
<div class="cover-left"></div>
<div class="cover-right"></div>
<div class="cover-bottom"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
首先,你应该只发布相关代码,这样人们就可以快速发现问题。
第一部分:
将这一行添加到css中可能会有所帮助。问题可能在于优先级,但老实说,html和css太多了。
.main-sidebar.main-sidebar-view{
z-index:1000;
background-color:#fff;
}
第二部分:
下拉列表无法打开,可能是因为没有javascript执行某些操作,或者您没有粘贴它?
js prettyprint-override">$(".burger-btn-wrapper").click(function() {
$(".main-sidebar").toggleClass("main-sidebar-view");
$(".submenu-dropdown").hide();
});
.container {
height: 768px;
}
.navbar {
display: block;
width: 100%;
position: relative;
margin-bottom: 640px;
color: #333;
background-color: #fff;
}
.navbar-logo-wrapper {
position: absolute;
height: 60px;
width: 100%;
top: 0;
left: 0;
text-align: center;
z-index: 999;
}
.navbar-logo-wrapper img {
width: 32px;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-top {
width: 100%;
height: 60px;
box-shadow: 0px 1px 8px 0 rgba(0,0,0,0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 32px;
box-sizing: border-box;
position: relative;
background-color: #fff;
}
.navbar-top-left {
z-index: 999;
}
.burger-btn-wrapper {
display: inline-block;
text-align: center;
margin: 0 16px 0 0;
}
.burger-btn-wrapper i {
font-size: 16px;
color: #333;
line-height: 60px;
transform: translateY(1px);
}
.module-name {
height: 60px;
line-height: 60px;
text-transform: uppercase;
display: inline-block;
font-size: 13px;
font-weight: 700;
color: #333;
}
.navbar-top-right {
z-index: 999;
}
.navbar-top-middle {
height: 60px;
text-align: center;
position: relative;
line-height: 0;
}
.modules-icon {
vertical-align: middle;
display: inline-block;
width: 60px;
text-align: center;
}
.modules-icon i {
font-size: 16px;
color: #333;
line-height: 60px;
}
.navbar-profile {
display: inline-block;
vertical-align: middle;
line-height: 0;
cursor: pointer;
}
.navbar-profile img {
vertical-align: top;
}
.profpic-wrapper {
display: inline-block;
vertical-align: middle;
width: 60px;
height: 60px;
cursor: pointer;
}
.navbar-profpic {
width: 40px;
height: 40px;
background-color: #00c983;
border-radius: 40px;
position: relative;
margin-left: 10px;
margin-top: 10px;
}
.profile-initial {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
}
.profile-name {
display: inline-block;
vertical-align: middle;
font-size: 13px;
}
.profile-dropdown-icon {
vertical-align: middle;
display: inline-block;
margin-left: 8px;
}
.profile-dropdown-icon i {
font-size: 10px;
}
.navbar-wrapper {
display: inline-block;
width: 100%;
}
.navbar-top-middle img {
height: 32px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar-menu {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
}
.navbar-menu-list {
width: 750px;
list-style-type: none;
margin: 0;
padding: 15px 0;
cursor: pointer;
z-index: -1;
margin-left: 0;
}
.navbar-menu-each {
padding-left: 32px;
padding-right: 32px;
display: inline-block;
position: relative;
}
.navbar-menu-each:first-child {
padding-left: 32px;
}
.navbar-menu-each a {
color: #333;
font-size: 13px;
text-decoration: none;
}
.menu-on a {
font-weight: 700;
color: #00c983;
}
.navbar-page-name {
display: block;
font-size: 22px;
height: 60px;
line-height: 60px;
border-top: solid 0.5px #DEF5ED;
border-bottom: solid 0.5px #DEF5ED;
background-color: #F0FBF7;
color: #333;
padding-left: 32px;
}
.navbar-menu::-webkit-scrollbar {
height: 0;
}
.navbar-menu::-webkit-scrollbar-thumb {
background-color: transparent;
}
.profile-dropdown {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
position: absolute;
cursor: pointer;
top: 106px;
}
.submenu-dropdown {
display: none;
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0, 0, 0, 0.15);
cursor: pointer;
position: absolute;
top: 20px;
left:0;
}
.navbar-menu-each:hover > .submenu-dropdown,
.submenu-dropdown:hover {
display: block;
}
.submenu-dropdown-each {
display: block;
line-height: 48px;
font-size: 13px;
color: #333;
width: auto;
padding: 0 32px 0 24px;
}
.submenu-dropdown-each:hover {
background: #f8f8f8;
}
.submenu-selected {
font-weight: 700;
color: #00c983;
}
.profile-dropdown {
padding-top: 8px;
width: 208px;
top: 53px;
right: 20px;
display: none;
}
.profile-dropdown-each {
display: block;
font-size: 13px;
line-height: 36px;
padding-left: 16px;
}
.profile-dropdown-each-section {
color: #aaa;
text-transform: uppercase;
font-weight: 700;
}
.profile-dropdown-check {
float: right;
margin-right: 16px;
}
.profile-dropdown-each-border-top {
border-top: solid 1px #eee;
}
.switch-language-group {
float: right;
margin-right: 16px;
}
.button-language {
height: 24px;
width: 32px;
border: solid 1px #c4c4c4;
display: inline-block;
line-height: 24px;
text-align: center;
}
.button-language-left {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
transform: translateX(4px);
}
.button-language-right {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.button-language-active {
background-color: #00c983;
color: #fff;
border: solid 1px #00c983;
}
.profile-dropdown-check i {
display: none;
}
.profile-dropdown-check i.role-active {
display: inline-block;
color: #00c983;
}
.navbar-module-wrapper {
display: inline-block;
width: 49%;
vertical-align: middle;
text-align: center;
height: 100px;
padding-top: 8px;
padding-bottom: 8px;
cursor: pointer;
border-radius: 3px;
}
.navbar-module-wrapper:hover {
background: #f8f8f8;
}
.navbar-module-wrapper-left {
}
.navbar-module-icon {
width: 48px;
padding: 16px 16px 8px 16px;
}
.caption-basic {
transform: translateY(8px);
}
.icon-tm {
width: 44px;
transform: translateY(-4px);
}
.caption-tm {
transform: translateY(-8px);
}
.icon-recr {
width: 46px;
}
.caption-recr {
transform: translateY(4px);
}
.icon-talent {
width: 38px;
transform: translateY(-2px);
}
.caption-talent {
transform: translateY(-6px);
}
.icon-bm {
width: 50px;
}
.caption-bm {
transform: translateY(-4px);
}
.navbar-module-name {
line-height: 16px;
vertical-align: middle;
height: 60px;
}
.main-sidebar {
background-color: #fff;
box-shadow: 0px 3px 6px 0 rgba(0,0,0,0.15);
width: 240px;
font-size: 13px;
color: #333;
position: absolute;
top: 51px;
left: -260px;
-webkit-transition: left 0.5s;
transition: left 0.5s;
height: 717px;
}
.main-sidebar-list-wrapper {
height: 669px;
width: 240px;
overflow: auto;
}
.main-sidebar-view {
left: 0;
-webkit-transition: left 0.5s;
transition: left 0.5s;
}
.sidebar-section {
width: 240px;
}
.sidebar-section li {
display: block;
line-height: 48px;
padding-left: 16px;
height: 48px;
}
.sidebar-section-title {
border-bottom: solid 1px #eee;
font-size: 16px;
}
.sidebar-icon {
position: relative;
display: inline-block;
width: 28px;
height: 48px;
}
.sidebar-icon img {
width: 18px;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.sidebar-menu {
display: inline-block;
vertical-align: top;
}
.main-sidebar-list-wrapper::-webkit-scrollbar {
height: 0;
}
.main-sidebar-list-wrapper::-webkit-scrollbar-thumb {
background-color: transparent;
}
.main-sidebar-footer {
height: 48px;
line-height: 48px;
text-align: center;
border-top: solid 1px #eee;
}
@media (max-width: 767px) and (min-width: 576px) {
.navbar-top {
padding: 0 24px;
}
.navbar-menu-each:first-child {
padding-left: 24px;
}
.navbar-page-name {
padding-left: 24px;
}
.callout {
right: 94px;
}
}
@media (max-width: 575px) {
.module-name {
display: none;
}
.profile-name {
display: none;
}
.modules-icon {
display: none;
}
.navbar-top {
padding: 0 16px;
}
.navbar-menu-each:first-child {
padding-left: 16px;
}
.navbar-page-name {
padding-left: 16px;
}
.profile-dropdown-icon {
margin-left: 0;
}
}
.main-sidebar.main-sidebar-view{
z-index:1000;
background-color:#fff;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i" rel="stylesheet">
<div class="container">
<div class="navbar">
<div class="main-sidebar">
<div class="main-sidebar-list-wrapper">
<ul class="sidebar-section">
<li class="sidebar-section-title">Organization</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/LZ44Z0dPvtn2OCGT02lwNZuaUK76Zw69uaYSF4sTe63PtTpKS4IiUM7LjsV5VvlH1hsB6bZM4rA8g9fVsYgUzg/192"></span>
<span class="sidebar-menu">Company</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/8pNCxwrs9k-2fnR6iCzgQ-FEhutp_EcFTTfb9jD207NZSwBU98yuTSPZAKwsh7muBJKKG-MBcsgoqbEpXnZLnQ/213"></span>
<span class="sidebar-menu">Employee</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/mE5M0CywlR63kvqGKenpBEdDFYpOnpHB02javJrGr8r0gJGl_-vuUnKJJpWe6pZChsjIq1yXUgofhicw7MvFCw/177"></span>
<span class="sidebar-menu">Termination</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Compensation & Benefits</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/YlkzS0yo52ARysEUFWYs53WfQH7D1kGaAoxmnqhpSOX7nDKTgYxPsF8CuP-EQlJBNM_ye68YqYc2J0BcSLPJwg/159"></span>
<span class="sidebar-menu">Setup</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/vYgvWe324-eiGFdWDNoBi7WrWHUAFhEbZCoLWve5NE2rBrFrGmK7ZLjW3W0ggCHce1BCyY6FFTzxRm-Fg9VmBA/168"></span>
<span class="sidebar-menu">BPJS Ketenagakerjaan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/bVKXdl3sBeP8-w1wTrEapdUOlcJFSPi4_koRbRVtzL2NR8N-BPZdJUdpPWjSXC13Um6GLbt5DO1DV2t_j7hQDw/168"></span>
<span class="sidebar-menu">BPJS Kesehatan</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/TaVNZzoRbkdvziFtWEyv4sEVQMnVVteQt2CB9aCU4xyOdTaCTDAqL9mqUA-3nGmdJZ7qzLZbxXr2xfXjlVDpDg/173"></span>
<span class="sidebar-menu">Payroll</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/NAZCBsbI_bURxMPsr3N05H2_d8KSiz_RtfaMqHp8Tg8tKFEb4RN-5aHgFQiz0y05Ik4BAD8RMRb5LC-Ufg35zA/175"></span>
<span class="sidebar-menu">PPh 21</span>
</li>
</ul>
<ul class="sidebar-section">
<li class="sidebar-section-title">Admin Panel</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/FNTOwLJTLz1ndzUxgINBH_tCYJgn7rp-HvtVlpTSN1RQ1yuy1q7UskqQikaey0uHl2Fu7C-rXOgaw_VsGH82Lg/136"></span>
<span class="sidebar-menu">User Management</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/DLaWkbWQ4jxYfEVNpCKBxOyS8G1mzuN24jzbf62tvMsYRvMD0zob2s2K1mBCj62YTYM_MaQmJlt6KmS0WY2uwA/159"></span>
<span class="sidebar-menu">Master Data</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/h2z5yDkjFcZ5OwhHWcI6VrhUL9Yj-u43QPEjlo7XyHE2pR-ghxrJdXw8mfB5C89AzEd403gqfCrd2JAUMbJ1xQ/199"></span>
<span class="sidebar-menu">Log</span>
</li>
<li class="sidebar-section-each">
<span class="sidebar-icon"><img src="https://cdn.frontify.com/api/screen/thumbnail/cn4XSK1tZu9KoSq5Q7iQXAMWcqjw5JolDHCvP52UD2wvu2brkBoit1F7SDUJmFVChGbo1LthZixKzx5ee3jJsQ/156"></span>
<span class="sidebar-menu">Data Migration</span>
</li>
</ul>
</div>
<div class="main-sidebar-footer">
© CATAPA 2017
</div>
</div>
<div class="navbar-logo-wrapper">
<img class="navbar-tree" src="https://cdn.frontify.com/api/screen/thumbnail/7UV_lfX5OBfHxFn5lc3ygK8UTU3z5pivwY9QDSDIOiFemj-DdmDzmwiPvbibaG63IMXz-MmGOs4aH-UqgoT9gw/350">
</div>
<div class="navbar-top">
<div class="navbar-top-left">
<div class="burger-btn-wrapper">
<i class="fas fa-bars"></i>
</div>
<div class="module-name">Employee</div>
</div>
<div class="navbar-top-right">
<div class="modules-icon"><i class="fas fa-th"></i></div>
<div class="navbar-profile">
<div class="profpic-wrapper">
<div class="navbar-profpic">
<div class="profile-initial">DJ</div>
</div>
</div>
<div class="profile-name">Dennis Jonathan</div>
<div class="profile-dropdown-icon"><i class="fas fa-chevron-down"></i></div>
</div>
</div>
</div>
<div class="navbar-menu">
<ul class="navbar-menu-list">
<li class="navbar-menu-each">
<a href="#">Employee Directory</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>New Employee Registration</li>
<li class='submenu-dropdown-each submenu-selected'>Employee List</li>
<li class='submenu-dropdown-each'>Employee Rehire</li>
<li class='submenu-dropdown-each'>Employee Without Bank Account</li>
<li class='submenu-dropdown-each'>Employee Without PPh 21</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Memo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Memo Template</li>
<li class='submenu-dropdown-each'>Print Memo</li>
</ul>
</li>
<li class="navbar-menu-each"><a href="#">Bulk Update</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Download & Upload</li>
<li class='submenu-dropdown-each'>Send Email</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Approvals and Undo</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Approvals</li>
<li class='submenu-dropdown-each'>Employment Status Undo</li>
</ul>
</li>
<li class="navbar-menu-each">
<a href="#">Report</a>
<ul class="submenu-dropdown">
<li class='submenu-dropdown-each'>Employee Data Report</li>
<li class='submenu-dropdown-each'>Headcount Report</li>
<li class='submenu-dropdown-each'>Employee Recapitulation Report</li>
</ul>
</li>
</ul>
</div>
<div class="navbar-page-name">
Employee List
</div>
</div>
<div class="cover-top"></div>
<div class="cover-left"></div>
<div class="cover-right"></div>
<div class="cover-bottom"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
通常我们可能会认为 HTML 网页是个二维的平面,因为页面中的文本、图像或者其它元素都是按照一定顺序排列在页面上的,每个元素之间都有一定的间隙,不会重叠。然而,实际的网页其实是三维的,元素之间可能会发生堆叠(重叠),您可以通过 CSS 中的 z-index 属性来设置元素的堆叠顺序,如下图所示: 图:元素堆叠演示 每个元素都有一个默认的 z-index 属性,将 z-index 属性与 posit
我有一个SVG元素,它包含两个尺寸和位置完全相同的子元素。两者唯一的区别是它们的颜色:第一个是红色,第二个是绿色。我注意到,即使绿色的圆圈在红色的上面,你仍然可以看到在圆圈的边缘有一点颜色偏移。我有什么办法可以避免这种颜色的变化吗? 下面是一张屏幕截图,显示了有红圈和没有红圈的情况: 这里还有我用来复制这个的小提琴。 null 欢迎任何不同的想法。
问题内容: 我正在尝试使用jQuery在可拖动元素上设置z-index。您可以在这里看到我在说什么以及到目前为止我所拥有的: 这是非常原始的,并且存在问题。关于如何使最后点击的元素具有最高z- index的任何想法,而不是将所有其余元素重置为基数,而是让它们逐步执行,因此,最后一次点击的第二个具有第二最高的元素,依此类推。 我遇到的另一个问题是,它仅在完全单击事件上起作用,而可拖动功能通过单击并按
描述 (Description) z-index设置元素的堆叠级别。 可能的值 (Possible Values) auto - 元素的堆栈级别与其父元素的堆栈级别相同。 integer - 元素的堆栈级别设置为给定值,并为任何后代元素建立新的堆栈上下文。 适用于 (Applies to) 所有定位的元素。 DOM语法 (DOM Syntax) object.style.zindex = "1";
问题内容: 使用绝对位置时,有什么方法可以覆盖父元素的z-index继承。我希望2222 div在0000 div之上: 我无法更改0000或1111 div的z索引,并且尝试将2222元素相对于1111元素定位。 问题答案: 我相信z-index是相对于最近定位的元素。因此,如果您在“ 1111” div中有两个div,则它们可以相对于彼此进行z索引,但是由于2222是1111的子元素,因此不能
我在geeksforgeeks网站上读到了关于用javascript和python实现堆栈的文章。我在javascript中实现了删除堆栈中的中间元素的代码,就像在同一个网站中为python提供的代码一样。但我答错了。为什么会这样?这两种语言在这种情况下有什么不同?如何在JavaScript中得到正确答案?下面是JavaScript中的代码。