i was using this code for adding some animation to the nav bar
$(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');
}
});
then i added some css
html , body {
overflow-x: hidden;
}
.full-width-bar {
margin: 0 -9999rem;
/* add back negative margin value */
padding: 0.25rem 9999rem;
background: rgba(0, 0, 0, 0.5);
}
and the overflow-x: hidden;
on the body ruin the window scroll so please any help to fix this or any alternative way to do this and many thanks in advance
i didn't find any solution for this so i remove the overflow-x
but before that i tried and the best thing i come with is
var up_wind = 0;
$(window).bind("mousewheel DOMMouseScroll wheel", function (event, delta) {
console.log(delta);
if (delta>= 0 && delta != "undefined") {
if(up_wind != 0){
up_wind--;
console.log('Scroll up');
console.log(up_wind);
}
}
else if(delta != "undefined") {
if(up_wind >= 0)
up_wind++;
console.log('Scroll down');
console.log(up_wind);
}
if(up_wind > 1){
$('.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');
}
});
hope will help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.