Uncaught TypeError: Cannot read property ‘offsetWidth’ of null
-
I am getting this error in my page from spacious: navigation.js:9
subMenu=jQuery(this).next('.sub-menu, .children');if(subMenu.length>0){var viewportClass=isElementInViewport(subMenu);if(false!==viewportClass){subMenu.addClass(viewportClass);}}}});})();(function(){jQuery(document).ready(function(){var mainWrapper=document.querySelector('#header-text-nav-container .inner-wrap'),branding=document.getElementById('header-left-section'),headerAction=document.querySelector('.header-action'),navigation=document.getElementById('site-navigation'),mainWidth=mainWrapper.offsetWidth,brandWidth=branding.offsetWidth,navWidth=navigation.offsetWidth,headerActionWidth=headerAction.offsetWidth,isExtra=(brandWidth+navWidth+headerActionWidth)>mainWidth,more=navigation.getElementsByClassName('tg-menu-extras-wrap')[0],headerDisplayTypeFour=document.getElementById('spacious-header-display-four');if(headerDisplayTypeFour!==null){isExtra=(navWidth+headerActionWidth)>=mainWidth;}
It is the reference to
headerActionWidth=headerAction.offsetWidth
From what I can see, headerAction is set as
headerAction=document.querySelector('.header-action')
I am using a child theme so I think this is the problem BUT – this isn’t the first time a Spacious theme update has broken my child theme.
It would appear that the backwards compatibility of updates is flimsy
- The topic ‘Uncaught TypeError: Cannot read property ‘offsetWidth’ of null’ is closed to new replies.