Unable to get property 'top' of undefined or null reference

soyarma's picture
soyarma
Sun, 12/13/2015 - 16:42
#1
Unable to get property 'top' of undefined or null reference

The Mega Menu module constantly creates the "Unable to get property 'top' of undefined or null reference" error as a user scrolls through the page. I traced it down to a problem in the awemenu.min.js file. Its a bit hard to parse since its minimized, but here is what I think that the issue is:

In the minimized file there is this line: 

h=isNaN(parseInt(this.options.stickyOffset))?b(this.options.stickyOffset).offset().top+b(this.options.stickyOffset).height():parseInt(this.options.stickyOffset)

The error is in trying to get .top off the offset for this.options.stickyOffset. For whatever reason, this is undefined here. If add &&this.lenght>0 to the condition then all is well. its difficult to tell what should be going on there, but since I'm not using the menu in sticky mode, I wonder if there is some check that is missing and its getting into a bit of code it shouldn't

The error wasn't breaking anything, it was just anoying to see in the console.

For anyone who wants it, find the code above in awemenu.min.js and change it to this:

h=isNaN(parseInt(this.options.stickyOffset))&&this.length>0?b(this.options.stickyOffset).offset().top+b(this.options.stickyOffset).height():parseInt(this.options.stickyOffset)

phuonght's picture
phuonght
Mon, 12/14/2015 - 05:45

Hi,

Thank you for your feedback. It will help our team and other customers so much. 

If there is any problem when using our mega menu in the future, please feel free to contact us.

brave's picture
brave
Thu, 03/31/2016 - 06:28

Thanks for the hint. It has helped me. No more error messages !! thank you

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.