dustin.schreiber pro asked 7 years ago


I'm getting an uncaught exception in the DevTools in Chrome. When scrolling, I am continuously getting the error written out to the console. It stops when I stop scrolling. Uncaught TypeError: Cannot read property 'top' of undefined Code: https://pastebin.com/PtjHST4T I cleaned up and removed personal information about the customer and their business Some URLs won't work, I am working with the Laravel PHP framework to build the site. I do have, and I am using, the Pro version of MDB

Mikołaj Smoleński staff answered 7 years ago


It happens, because there is no navbar on Your page. To fix it please change code lines to: $(window).scroll(function () { if( $('.navbar').length ) { if ($('.navbar').offset().top > OFFSET_TOP) { $('.scrolling-navbar').addClass('top-nav-collapse'); } else { $('.scrolling-navbar').removeClass('top-nav-collapse'); } } }); Regards

dustin.schreiber pro commented 7 years ago

Hey, thanks for the code and explanation. I didn't try the code but I ended up adding the nav bar back in and it seems resolved. Thanks!


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags