我的粘性导航栏没有 scrolled/fixed 到屏幕顶部时无法点击

My sticky navigation bar cannot be clicked when it's not scrolled/fixed to the top of the screen

当导航栏未固定在浏览器顶部时,我无法使其正常运行。

这是我正在使用的粘性导航代码:

//sticky menu bar
menuTop = $('nav').offset().top;
menuOffset = menuTop;
function fixedMenu(){  

scrollTop = $(window).scrollTop(); 

if (scrollTop > menuTop) {  
    $('nav').addClass('nav-fixed');  
}
else if (scrollTop  > menuOffset) { 
    $('nav').removeClass('nav-fixed');  
} 
else{
    $('nav').removeClass('nav-fixed');    
    }  
} 
fixedMenu(); 
$(window).scroll(function() { 
fixedMenu();    
});
//scrolling
$('nav a').click(function(){
$('body,html').animate({scrollTop: $( $.attr(this, 'href') ).offset().top - 60}, 400);
//stops page from reloading
return false;
});
});

提前致谢!

我查看了您的网站,发现此 class "nav ul" 需要添加一个 z-index。试试这个,看看是否有帮助(css):

nav ul {
list-style-type: none;
text-decoration: none;
color: #fff;
text-align: center;
position: relative;
min-width: 1200px;
z-index: 1;
}