TypeError jQuery offset().top is undefined
it work for me like this
$('.custom-scrollbar').animate({
scrollTop: $('a.sidebar-link.sidebar-title.active').offset.top - 200
}, 1000);
offset without ()
It 's because your $(".navbar") cannot be found. Check if the element exist before getting offset.
if ($(".navbar").length) {...}