Recently, I implemented some code to add animation to the navigation bar. Here is what I used:
$(window).on("scroll", function () {
if ($(this).scrollTop() > 20) {
$('.top-menu .navbar').removeClass('remove-nav-move');
$('.top-menu .navbar').addClass('nav-move');
} else {
$('.top-menu .navbar').removeClass('nav-move');
$('.top-menu .navbar').addClass('remove-nav-move');
}
});
After that, I decided to add some CSS styling as well:
html , body {
overflow-x: hidden;
}
.full-width-bar {
margin: 0 -9999rem;
/* Added negative margin value back */
padding: 0.25rem 9999rem;
background: rgba(0, 0, 0, 0.5);
}
However, I encountered an issue where the overflow-x: hidden;
on the body was disrupting the window scroll functionality. Could anyone provide a solution to this problem or suggest an alternative approach? Thank you in advance.