Skip to content

Commit

Permalink
Fix JS error when there is no active menu
Browse files Browse the repository at this point in the history
Everything is in the title, hope this helps :)
  • Loading branch information
geoffrey-brier authored Dec 23, 2017
1 parent 46c70c1 commit 303e4e9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,11 @@ $.AdminBSB.leftSideBar = {

//Scroll active menu item when page load, if option set = true
if ($.AdminBSB.options.leftSideBar.scrollActiveItemWhenPageLoad) {
var activeItemOffsetTop = $('.menu .list li.active')[0].offsetTop
if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' });
var item = $('.menu .list li.active')[0];
if (item) {
var activeItemOffsetTop = item.offsetTop;
if (activeItemOffsetTop > 150) $el.slimscroll({ scrollTo: activeItemOffsetTop + 'px' });
}
}
}
},
Expand Down Expand Up @@ -455,4 +458,4 @@ $(function () {
$.AdminBSB.search.activate();

setTimeout(function () { $('.page-loader-wrapper').fadeOut(); }, 50);
});
});

0 comments on commit 303e4e9

Please sign in to comment.