您好,我的新网站出现此错误,我无法使用移动菜单导航,我们将不胜感激...欢呼..
var OnePageNavigation = function() {
var navToggler = $('.site-menu-toggle');
$("body").on("click", ".main-menu li a[href^='#'], .smoothscroll[href^='#'], .site-mobile-menu .site-nav-wrap li a", function(e) {
e.preventDefault();
var hash = this.hash;
$('html, body').animate({
'scrollTop': $(hash).offset().top
}, 600, 'easeInOutCirc', function(){
window.location.hash = hash;
});
});
};
OnePageNavigation();
答案 0 :(得分:0)
解决了。...
var OnePageNavigation = function() {
var navToggler = $('.site-menu-toggle');
$("body").on("click", ".main-menu li a[href^='#'], .smoothscroll[href^='#'], .site-mobile-menu .site-nav-wrap li a", function(e) {
if (this.hash !== "" && this.pathname == window.location.pathname) {
e.preventDefault();
var target = this.hash;
var topOffset = 0; //#top should default to 0 so no need to calculate the difference between top and top :)
if (target != "#top") { //If the target is not "#top", then calculate topOffset
var topOffset = $(target).offset().top;
}
$('html, body').animate({
'scrollTop': $(target).offset().top
}, 600, 'easeInOutCirc', function(){
window.location.hash = target;
});
}
});
};
OnePageNavigation();