重构代码:移除sidebar-menu元素id
This commit is contained in:
parent
1af42a61d2
commit
36238f69a2
|
@ -2,7 +2,7 @@
|
||||||
<aside>
|
<aside>
|
||||||
<div id="sidebar" class="sidebar">
|
<div id="sidebar" class="sidebar">
|
||||||
<!-- sidebar menu start-->
|
<!-- sidebar menu start-->
|
||||||
<ul class="sidebar-menu" id="nav-accordion">
|
<ul class="sidebar-menu">
|
||||||
@foreach (var menu in Model.Navigations)
|
@foreach (var menu in Model.Navigations)
|
||||||
{
|
{
|
||||||
@await Html.PartialAsync("SubMenu", menu)
|
@await Html.PartialAsync("SubMenu", menu)
|
||||||
|
|
|
@ -134,10 +134,11 @@ $(function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var $sidebar = $("#sidebar");
|
var $sidebar = $("#sidebar");
|
||||||
|
var $sideMenu = $sidebar.find('.sidebar-menu');
|
||||||
var $main = $('#main-content');
|
var $main = $('#main-content');
|
||||||
var $breadNav = $('#breadNav');
|
var $breadNav = $('#breadNav');
|
||||||
|
|
||||||
$('#nav-accordion').dcAccordion({
|
$sideMenu.dcAccordion({
|
||||||
autoExpand: true
|
autoExpand: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ $(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
// breadcrumb
|
// 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());
|
if (arch.text() !== "") $breadNav.removeClass('d-none').text(arch.text());
|
||||||
var top = (arch.offset() || { top: 0 }).top;
|
var top = (arch.offset() || { top: 0 }).top;
|
||||||
if (top > 0) {
|
if (top > 0) {
|
||||||
|
|
Loading…
Reference in New Issue