修改BUG:配置的菜单与地址可能不一致,导致面包屑导航条多了一个斜杠

This commit is contained in:
Argo-Lenovo 2016-11-19 20:26:01 +08:00
parent 453df71404
commit 702912d1c8
2 changed files with 3 additions and 6 deletions

View File

@ -21,9 +21,7 @@
// breadcrumb // breadcrumb
var arch = $('#nav-accordion').find('a.active').last(); var arch = $('#nav-accordion').find('a.active').last();
var breadcrumb = arch.text(); $breadNav.text(arch.text());
if (breadcrumb === "") $breadNav.hide();
else $breadNav.text(breadcrumb);
var top = arch.offset().top; var top = arch.offset().top;
if (top > $sidebar.height()) $sidebar.animate({ scrollTop: top + 300 - $sidebar.height() }, 800); if (top > $sidebar.height()) $sidebar.animate({ scrollTop: top + 300 - $sidebar.height() }, 800);

View File

@ -3,9 +3,7 @@
function setActive(ele) { function setActive(ele) {
ele.addClass('active'); ele.addClass('active');
ele.parents("ul").first().find('p').addClass('active'); ele.parents("ul").first().find('p').addClass('active');
var breadcrumb = ele.text(); $breadNav.text(ele.text()).show();
if (breadcrumb === "") $breadNav.hide();
else $breadNav.text(breadcrumb);
} }
$('#navbar').attr('data-toggle', "dropdown").addClass('dropdown-toggle'); $('#navbar').attr('data-toggle', "dropdown").addClass('dropdown-toggle');
var $subMenu = $('#submenu'); var $subMenu = $('#submenu');
@ -19,6 +17,7 @@
setActive($this); setActive($this);
$('iframe').attr('src', $this.attr('href')); $('iframe').attr('src', $this.attr('href'));
}); });
$breadNav.hide();
$subMenu.find('a').each(function (index, ele) { $subMenu.find('a').each(function (index, ele) {
var $this = $(this); var $this = $(this);
if ($this.attr('href') == window.location.pathname) setActive($this); if ($this.attr('href') == window.location.pathname) setActive($this);