This code is used on the website for smooth scrolling along an anchor.
$('a[href*="#"]') .not('[href="#"]') .not('[href="#0"]').on('click', function(event) { if ($(this).closest('ul').hasClass('story-anchors')) { var windowHeight = $(window).height(), countWindows = $(this).attr("data-windowCount"); clickAnchor(this, 0, 0, 1200, 0, windowHeight, countWindows); } else if ($(this).closest('ul').hasClass('anchors-list')) { var navHeight = $('.anchors-list').outerHeight() - 2; clickAnchor(this, navHeight, 1, 500, 1, 0, 0); } else { clickAnchor(this, 0, 1, 500, 1, 0, 0); } }); function clickAnchor(ob, heightNav, attrHeaderHeight, speed, attrTop, windowHeight, countWindows) { event.preventDefault(); var headerHeight = $('.header').height(); $('html, body').animate({ scrollTop: (windowHeight * countWindows) + ($($.attr(ob, 'href')).offset().top * attrTop) - (headerHeight * attrHeaderHeight) - heightNav }, speed); } On one of the pages is a link to the anchor, which is located on another page. When clicking on such a link in the console, it knocks out:
Uncaught TypeError: Cannot read property 'top' of undefined
The function in this case uses the last else.
Is this somehow fixed?