我为Navbar(主菜单)写了一小段代码,当您向上滚动时显示菜单,然后向下滚动时隐藏它,这在Firefox中完全可以,但在Chrome中不起作用,
我的网页是:https://PowerEn.ir 这是我的js:
jQuery(document).ready(function(e) {
if (992 <= e(window).width()) {
var n = document.querySelector(".nav2"),
t = document.querySelector(".nav4"),
s = document.querySelector(".nav5"),
o = 0;
window.addEventListener("scroll", function() {
window.pageYOffset <= 0 && (o = window.pageYOffset), window.pageYOffset < o && (n.classList = "menu_categoryshow", t.classList = "nbg-light", s.classList = "nehsan-menu", o = window.pageYOffset), (window.pageYOffset > o || window.pageYOffset <= 690) && (n.classList += " upp", o = window.pageYOffset)
})
}});
很遗憾,我不是专家,在此先感谢您的帮助。