平滑滚动的问题

时间:2016-07-21 20:10:38

标签: javascript jquery

我有这个网站toncandigital.com,滚动顺畅,但显然这在订阅部分毁了我的Twitter和facebook的主播。

我有这个javascript代码。

$(document).on('click', 'a', function(event){
	event.preventDefault();

	$('html, body').animate({
	    scrollTop: $( $.attr(this, 'href') ).offset().top
	}, 700);
});

如果你能帮助我,我会很感激:P

1 个答案:

答案 0 :(得分:2)

您应该将平滑滚动限制为导航链接:

$(document).on('click', 'nav.Menu a', function(event){
    event.preventDefault();

    $('html, body').animate({
        scrollTop: $( $.attr(this, 'href') ).offset().top
    }, 700);
});
相关问题