Topic: scrolling-navbar.js has a bug

trymkb pro asked 7 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');
}
});
}



Thank you for the suggestion! This will be added to new version of MDB

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No
Tags