重构代码:移除sidebar-menu元素id

This commit is contained in:
Argo-MacBookPro 2018-09-16 01:25:52 +08:00
parent 1af42a61d2
commit 36238f69a2
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<aside>
<div id="sidebar" class="sidebar">
<!-- sidebar menu start-->
<ul class="sidebar-menu" id="nav-accordion">
<ul class="sidebar-menu">
@foreach (var menu in Model.Navigations)
{
@await Html.PartialAsync("SubMenu", menu)

View File

@ -134,10 +134,11 @@ $(function () {
};
var $sidebar = $("#sidebar");
var $sideMenu = $sidebar.find('.sidebar-menu');
var $main = $('#main-content');
var $breadNav = $('#breadNav');
$('#nav-accordion').dcAccordion({
$sideMenu.dcAccordion({
autoExpand: true
});
@ -153,7 +154,7 @@ $(function () {
$('[data-toggle="tooltip"]').tooltip();
// breadcrumb
var arch = $('#nav-accordion').find('a.active').last();
var arch = $sideMenu.find('a.active').last();
if (arch.text() !== "") $breadNav.removeClass('d-none').text(arch.text());
var top = (arch.offset() || { top: 0 }).top;
if (top > 0) {