修改BUG:未配置到菜单的网页arch.offset()为undefined脚本出错

This commit is contained in:
Argo-Lenovo 2016-12-22 22:08:10 +08:00
parent b38f4120b1
commit 820875595b
1 changed files with 2 additions and 2 deletions

View File

@ -59,8 +59,8 @@ $(function () {
// breadcrumb
var arch = $('#nav-accordion').find('a.active').last();
$breadNav.text(arch.text());
var top = arch.offset().top;
$breadNav.text(arch.text() || $('title').text());
var top = (arch.offset() || { top: 0 }).top;
if (top > 0) {
var middle = $('header').outerHeight() + $sidebar.outerHeight() / 2;
if (top > middle) $sidebar.animate({ scrollTop: top + arch.outerHeight() / 2 - middle }, 500);