Topic: Error on scroll
Cynthia Sánchez García pro asked 7 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
Add comment
Jakub Strebeyko staff answered 7 years ago
Hi Cynthia,
To resolve this issue instantly, you can wrap the existing
Thank you for pointing it out - we will implement fix in the next release.
With Regards,
Kuba
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,
Kuba
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Closed
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