Cynthia Sánchez García pro asked 6 years ago

Hi, I have downloaded the version 4.4.3, but after updating the libraries on my site, I´m getting an error regarding to `Cannot read property 'top' of undefined`. Checking the code, I saw this piece: ``` $(window).scroll(function () { if ($('.navbar').offset().top > OFFSET_TOP) { $('.scrolling-navbar').addClass('top-nav-collapse'); } else { $('.scrolling-navbar').removeClass('top-nav-collapse'); } }); ``` I´m not using `navbar` on my site, could you please to check if `navbar` exists to run the piece of code. Thanks

Jakub Strebeyko staff answered 6 years ago

Hi Cynthia, To resolve this issue instantly, you can wrap the existing if checking for navbar offset in another, checking whether such an element exists at all, for example:
if ( $( '.navbar' ).length ) { [navbar offset if's] }
Thank you for pointing it out - we will implement fix in the next release.

With Regards,

Cynthia Sánchez García pro commented 6 years ago

Thanks Kuba


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



Specification of the issue

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