Topic: scrolling-navbar.js has a bug
                  
                  trymkb
                  pro
                  asked 8 years ago
                
It does not seem to check if it is needed, so it drops errors on scrolling.
Fixed version
'use strict';
/* SCROLLING NAVBAR */ 
var OFFSET_TOP = 50;
var SCROLLING_NAVBAR = (($('.navbar').length)?true:false);
if(SCROLLING_NAVBAR) {
$(window).scroll(function () {
if ($('.navbar').offset().top > OFFSET_TOP) {
$('.scrolling-navbar').addClass('top-nav-collapse');
} else {
$('.scrolling-navbar').removeClass('top-nav-collapse');
}
});
}
                      
                      Bartłomiej Malanowski
                      staff
                        answered 8 years ago
                    
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
 - Premium support: No
 - Technology: General Bootstrap questions
 - MDB Version: -
 - Device: -
 - Browser: -
 - OS: -
 - Provided sample code: Yes
 - Provided link: No