You are currently viewing the left property from an object retrieved in the preceding row. The line causing trouble is:
var mainNavigationPosition = mainNavigationOffset.left;
The issue stems from mainNavigationOffset being undefined.
This problem arises because mainNavigationOffset is defined as:
var mainNavigationOffset = $('.js-nav-container > ul').offset();
It is plausible that jQuery could not obtain the offset of the element $('.js-nav-container > ul').
According to jQuery's documentation:
Note: jQuery does not provide support for retrieving the offset coordinates of hidden
elements or taking into account borders, margins, or padding applied to the
body element.
While obtaining the coordinates of elements with
visibility:hidden set is achievable, those with display:none are excluded from the rendering
tree and thus have an undefined position.
Verify if the element is actually visible.
Another possibility (which appears to be the case) is that the jQuery expression:
$('.js-nav-container > ul')
is not returning any element.
To check if the element is visible, you can utilize the Chrome DevTools:
display should not be equal to none
https://i.stack.imgur.com/Wg9cz.png
visibility must be equal to visible
https://i.stack.imgur.com/A4gWR.png
Alternatively, you can directly run the following commands in the console:
$('.js-nav-container > ul').css("display");
$('.js-nav-container > ul').css("visibility");