feat: add submenu function (#159 #186 #196)

pull/230/head
Seaton Jiang 2020-04-05 12:14:51 +08:00
parent e1e7efbdc0
commit 8c93e5bdc7
4 changed files with 79 additions and 17 deletions

View File

@ -80,18 +80,6 @@ h1,h2,h3,h4,h5,h6 {
font-weight: 400;
}
.navbar-light .navbar-nav .nav-link,.navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover {
color: #ffffff;
}
.navbar-light .navbar-nav .nav-link:hover {
color: rgba(255, 255, 255, 0.8);
}
.navbar-light .navbar-nav .nav-link .fas {
margin-right: 3px;
}
.tooltip-inner {
padding: 7px 6px;
font-size: 13px;
@ -203,11 +191,21 @@ button:focus {
font-size: 12px;
}
.k-nav .navbar-nav {
position: relative;
}
.k-nav .navbar-nav li {
margin-bottom: 0;
padding-left: 0;
list-style: none;
}
.k-nav .navbar-nav > li.nav-item > a {
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 400;
font-size: 16px;
font-size: 17px;
}
.k-nav .line {
@ -236,6 +234,44 @@ button:focus {
transform-origin: center;
}
.navbar-light .navbar-nav .nav-link,.navbar-light .navbar-nav .nav-link:focus, .navbar-light .navbar-nav .nav-link:hover,.navbar-light .navbar-nav .active>.nav-link, .navbar-light .navbar-nav .nav-link.active, .navbar-light .navbar-nav .nav-link.show, .navbar-light .navbar-nav .show>.nav-link {
color: #ffffff;
}
.navbar-light .navbar-nav .nav-link:hover {
color: rgba(255, 255, 255, 0.8);
}
.navbar-light .navbar-nav .nav-link .fas {
margin-right: 3px;
}
.navbar-light .navbar-nav .dropdown-menu {
margin: 2px 0 0;
padding: 5px 0;
min-width: 140px;
border: none;
font-size: 15px;
}
.dropdown-item.active, .dropdown-item:active {
background-color: #00a2ff;
}
.dropdown-toggle::after {
display: inline-block;
margin-left: 2px;
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
content: "\e62e";
vertical-align: unset;
font-size: 16px;
font-family: kicon;
transform: rotate(180deg);
}
@media screen and (max-width:1200px) {
.nav-tabs .nav-link {
padding: 8px 22px;
@ -309,11 +345,33 @@ button:focus {
}
}
@media screen and (max-width: 992px) {
.navbar-light .navbar-nav .dropdown-menu,.navbar-light .navbar-nav .dropdown-item.active,.navbar-light .navbar-nav .dropdown-item:active,.navbar-light .navbar-nav .dropdown-item:focus,.navbar-light .navbar-nav .dropdown-item:hover {
background-color: transparent;
}
.k-nav .navbar-nav > li.nav-item > a {
font-size: 16px;
}
.navbar-light .navbar-nav .dropdown-item {
color: #ffffff;
}
.navbar-light .navbar-nav .dropdown-menu {
padding: 0;
}
}
@media screen and (max-width: 768px) {
.k-nav .navbar-brand {
font-size: 19px;
}
.navbar-light .navbar-nav .nav-link {
font-size: 16px;
}
.navbar-light .navbar-brand:hover {
color: rgba(255, 255, 255, 0.8);
}

File diff suppressed because one or more lines are too long

View File

@ -44,7 +44,7 @@
<?php }
wp_nav_menu( array(
'theme_location' => 'header_menu',
'depth' => 1,
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'navbarResponsive',

View File

@ -183,7 +183,11 @@ if (!class_exists('WP_Bootstrap_Navwalker')) {
$id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth);
$id = $id ? ' id="' . esc_attr($id) . '"' : '';
$output .= $indent;
if ($args->has_children) {
$output .= $indent . '<li' . $id . ' class="nav-item dropdown" ' . '>';
} else {
$output .= $indent . '<li' . $id . ' class="nav-item" ' . '>';
}
// Initialize array for holding the $atts for the link item.
$atts = array();
@ -381,7 +385,7 @@ if (!class_exists('WP_Bootstrap_Navwalker')) {
if ($menu_class) {
$fallback_output .= ' class="' . esc_attr($menu_class) . '"';}
$fallback_output .= '>';
$fallback_output .= '<li class="nav-item"><a href="' . esc_url(admin_url('nav-menus.php')) . '" class="nav-link">' . _e('添加导航', 'kratos') . '</a></li>';
$fallback_output .= '<li class="nav-item"><a href="' . esc_url(admin_url('nav-menus.php')) . '" class="nav-link">' . esc_attr__('添加导航', 'kratos') . '</a></li>';
$fallback_output .= '</ul>';
if ($container) {
$fallback_output .= '</' . esc_attr($container) . '>';