When the Fixed-to-top navbar is used in mobile view, such as clicking a Navbar icon, it does not collapse afterward while the page is loading. How can I prevent the page from loading in the navbar section?
Here is the link to my website:
CLICK HERE
Additionally, this is my JavaScript code:
JavaScript Code
// Anchors Position
$('[data-hash]').on('click', function(e) {
e.preventDefault();
$('body').addClass('scrolling');
var target = $(this).attr('href')
delay = 0;
if($(document).scrollTop() == 0) {
$(document).scrollTop($('#header').height());
delay = 200;
}
setTimeout(function() {
if ($(window).width() < 991 && $('.nav-main-collapse').hasClass('in')) {
$('.nav-main-collapse').collapse('hide');
self.scrollToTarget(target);
return this;
}
self.scrollToTarget(target);
}, 200);
return this;
});
return this;
},
Below, I have attached a screenshot for reference: