style: 优化 AdminLTE 样式下 nav-brand 动画效果

This commit is contained in:
Argo Zhang 2019-08-22 13:13:29 +08:00
parent 00503fd83b
commit 991c2c6ef9
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 82 additions and 84 deletions

View File

@ -68,9 +68,9 @@
border: none !important; border: none !important;
} }
.userinfo .shadow-default, .nav [data-toggle="dropdown"], .nav [data-toggle="dropdown"]:hover { .userinfo .shadow-default, .nav [data-toggle="dropdown"], .nav [data-toggle="dropdown"]:hover {
box-shadow: none; box-shadow: none;
} }
.userinfo .dropdown-item { .userinfo .dropdown-item {
border-bottom: solid 1px rgba(255, 255, 255, 0.4); border-bottom: solid 1px rgba(255, 255, 255, 0.4);
@ -135,25 +135,20 @@ aside {
padding: 0 0.625rem; padding: 0 0.625rem;
} }
aside .nav-brand a { aside .nav-brand a {
display: flex;
justify-content: center;
align-items: center;
}
aside .nav-brand span, .header .sidebar-toggle-box {
font-size: 1.25rem;
white-space: nowrap; white-space: nowrap;
} }
.header .sidebar-toggle-box .fa {
font-size: 1rem;
}
aside .nav-brand img, aside:hover .nav-brand img { aside .nav-brand img, aside:hover .nav-brand img {
width: 2.125rem; width: 2.125rem;
height: auto; height: auto;
border-radius: 0.42rem; border-radius: 0.42rem;
margin-right: 0.25rem; }
aside .nav-brand span {
line-height: 2.125rem;
vertical-align: middle;
margin-left: 6px;
} }
aside .nav-link span { aside .nav-link span {
@ -161,17 +156,6 @@ aside {
white-space: nowrap; white-space: nowrap;
} }
.sidebar-open aside .nav-brand img, .sidebar-open aside:hover .nav-brand img {
opacity: 0;
visibility: hidden;
width: 2.125rem;
height: auto;
border-radius: 0.42rem;
position: absolute;
top: 11px;
left: 9px;
}
aside .nav-link span { aside .nav-link span {
display: inline-block; display: inline-block;
white-space: nowrap; white-space: nowrap;
@ -181,10 +165,10 @@ aside {
transition: margin-left .3s linear; transition: margin-left .3s linear;
} }
.main-header .breadcrumb { .main-header .breadcrumb {
margin-top: -10px; margin-top: -10px;
padding: 8px 0; padding: 8px 0;
} }
.main-header { .main-header {
display: block; display: block;
@ -228,9 +212,9 @@ aside .nav-brand {
color: #eee; color: #eee;
} }
.sidebar-toggle-box:hover, aside .nav-brand a:hover, .userinfo .dropdown-toggle:hover, .userinfo.show .dropdown-toggle, .nav [data-toggle="dropdown"]:hover, .sidebar .nav-link:hover, .userinfo .dropdown-item:hover, .userinfo .dropdown-item a:hover, .userinfo .dropdown-item:last-child a:hover { .sidebar-toggle-box:hover, aside .nav-brand a:hover, .userinfo .dropdown-toggle:hover, .userinfo.show .dropdown-toggle, .nav [data-toggle="dropdown"]:hover, .sidebar .nav-link:hover, .userinfo .dropdown-item:hover, .userinfo .dropdown-item a:hover, .userinfo .dropdown-item:last-child a:hover {
color: #fff; color: #fff;
} }
.sidebar .nav-sidebar .has-treeview .nav-link.active { .sidebar .nav-sidebar .has-treeview .nav-link.active {
background-color: rgba(60, 141, 188, 0.8); background-color: rgba(60, 141, 188, 0.8);
@ -241,8 +225,7 @@ aside .nav-brand {
} }
.sidebar .nav-sidebar > .nav-item > .nav-link[aria-expanded="true"], .sidebar .nav-sidebar > .nav-item > .nav-link[aria-expanded="true"],
.sidebar .nav-sidebar .nav-item:not(.parent) .nav-link.active:before .sidebar .nav-sidebar .nav-item:not(.parent) .nav-link.active:before {
{
background-color: rgba(59, 141, 188, 0.7); background-color: rgba(59, 141, 188, 0.7);
} }
@ -275,7 +258,7 @@ footer {
background: #2c3b41; background: #2c3b41;
} }
@media (max-width:768px){ @media (max-width:768px) {
body, .form-control, .dropdown-menu, .btn:not(.btn-lg):not(.btn-xs), .input-group-text, .popover-header { body, .form-control, .dropdown-menu, .btn:not(.btn-lg):not(.btn-xs), .input-group-text, .popover-header {
font-size: 0.75rem; font-size: 0.75rem;
} }
@ -285,16 +268,17 @@ footer {
padding: 0.375rem 1rem; padding: 0.375rem 1rem;
} }
.form-inline .form-group{ .form-inline .form-group {
margin-bottom:0.75rem; margin-bottom: 0.75rem;
} }
.form-inline .form-group .control-label { .form-inline .form-group .control-label {
margin-bottom: 0.125rem; margin-bottom: 0.125rem;
} }
.modal-body, .card-body { .modal-body, .card-body {
padding: 0.5rem 0.75rem 0 0.75rem; padding: 0.5rem 0.75rem 0 0.75rem;
} }
.modal-footer { .modal-footer {
padding: 0.5rem; padding: 0.5rem;
@ -331,10 +315,6 @@ footer {
display: none; display: none;
} }
.sidebar-open .header .sidebar-toggle-box span {
opacity: 1;
}
aside { aside {
top: 0; top: 0;
} }
@ -344,9 +324,9 @@ footer {
transition: top .3s linear; transition: top .3s linear;
} }
aside .sub .nav-tem, .sidebar-open aside:hover .sidebar .sub .nav-item { aside .sub .nav-tem, .sidebar-open aside:hover .sidebar .sub .nav-item {
margin-left: 10px; margin-left: 10px;
} }
aside .nav-brand, .sidebar-open aside:hover .nav-brand, aside .nav-header { aside .nav-brand, .sidebar-open aside:hover .nav-brand, aside .nav-header {
display: flex; display: flex;
@ -367,44 +347,59 @@ footer {
border-radius: 50%; border-radius: 50%;
} }
aside .nav-header span, .sidebar-open aside:hover .nav-header span { aside .nav-header span, .sidebar-open aside:hover .nav-header span {
color: #eee; color: #eee;
}
aside .sub .nav-link, .userinfo .dropdown-item, aside .sidebar .sub .nav-item, aside, aside .nav-header img {
transition: all .3s linear;
}
aside .nav-link span, aside .nav-brand span, aside .nav-header span, aside .nav-brand img {
transition: margin-left .3s linear, opacity .3s ease, visibility .3s ease;
}
.sidebar-open .header {
margin-left: 3.375rem;
}
.sidebar-open .header .sidebar-toggle-box span {
opacity: 1;
} }
aside .sub .nav-link, .userinfo .dropdown-item, aside .sidebar .sub .nav-item, aside, aside .nav-header img { .sidebar-open aside {
transition: all .3s linear; z-index: 15;
} }
aside .nav-link span, aside .nav-brand span, aside .nav-header span, aside .nav-brand img {
transition: margin-left .3s linear, opacity .3s ease, visibility .3s ease;
}
.sidebar-open aside:hover { .sidebar-open aside:hover {
width: 13.375rem; width: 13.375rem;
z-index: 15;
} }
.sidebar-open .header { .sidebar-open aside:hover .nav-brand img {
margin-left: 3.375rem; margin-left: 0;
}
.sidebar-open aside {
transform: translate(0);
width: 3.375rem;
}
.sidebar-open aside .nav-item span, .sidebar-open aside .nav-header span, .sidebar-open .nav-brand span {
opacity: 0;
visibility: hidden;
margin-left: -10px;
} }
.sidebar-open aside {
transform: translate(0);
width: 3.375rem;
}
.sidebar-open aside .nav-item span, .sidebar-open aside .nav-header span, .sidebar-open .nav-brand span {
opacity: 0;
visibility: hidden;
margin-left: -10px;
}
.sidebar-open aside .nav-brand img {
margin-left: 112px;
}
.sidebar-open aside .nav-header img { .sidebar-open aside .nav-header img {
width: 2.25rem; width: 2.25rem;
height: 2.25rem; height: 2.25rem;
} }
.sidebar-open aside .nav-brand img, .sidebar-open aside:hover .nav-brand span, .sidebar-open aside:hover .nav-header span, .sidebar-open aside:hover .nav-item span { .sidebar-open aside:hover .nav-brand span, .sidebar-open aside:hover .nav-header span, .sidebar-open aside:hover .nav-item span {
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
} }
@ -417,12 +412,12 @@ footer {
top: 115px; top: 115px;
} }
.sidebar-open .main-content { .sidebar-open .main-content {
margin-left: 3.375rem; margin-left: 3.375rem;
transition: margin-left .3s linear; transition: margin-left .3s linear;
} }
.sidebar-open aside .sidebar .sub .nav-item { .sidebar-open aside .sidebar .sub .nav-item {
margin-left: 0; margin-left: 0;
} }
} }

View File

@ -291,7 +291,7 @@ body, .form-control, .dropdown-menu, .btn:not(.btn-lg):not(.btn-xs), .input-grou
.sidebar .show .nav-item .nav-link:hover:before, .sidebar .show .nav-item .nav-link:hover:before,
.sidebar .nav-sidebar .nav-item:not(.parent) .nav-link.active:before, .sidebar .nav-sidebar .nav-item:not(.parent) .nav-link.active:before,
.sidebar .nav-sidebar .nav-link.active { .sidebar .nav-sidebar .nav-link.active {
background-color: rgba(255,255,255,.1); background-color: rgba(255,255,255,.1);
} }
.sidebar .nav-sidebar .show .nav-link, .sidebar .nav-sidebar .collapsing .nav-link { .sidebar .nav-sidebar .show .nav-link, .sidebar .nav-sidebar .collapsing .nav-link {
@ -310,9 +310,12 @@ body, .form-control, .dropdown-menu, .btn:not(.btn-lg):not(.btn-xs), .input-grou
transition: all .3s linear; transition: all .3s linear;
} }
.sidebar-toggle-box, .nav-brand span {
font-size: 1.25rem;
}
.sidebar-toggle-box { .sidebar-toggle-box {
display: block; display: block;
font-size: 1.25rem;
color: #777; color: #777;
flex: 1 1 auto; flex: 1 1 auto;
padding: 12px 0; padding: 12px 0;