我有一个使用 skrollr 和 skrollr 菜单的网站。在我添加 skrollr 之前,每次按下导航按钮时我都会清理 url。添加 Skrollr 菜单后,URL 的清理似乎不起作用。这是我在我的 js 文件中的代码。
// Click event for any anchor tag that's href starts with #
$('a[href^="#"]').click(function(event) {
// calculate height
var navHeight = $("header").outerHeight();
// The id of the section we want to go to.
var id = $(this).attr("href");
// An offset to push the content down from the top.
var offset = navHeight;
// Our scroll target : the top position of the
// section that has the id referenced by our href.
var target = $(id).offset().top - offset;
// The magic...smooth scrollin' goodness.
$('html, body').animate({scrollTop:target}, 500);
//prevent the page from jumping down to our section.
event.preventDefault();
});
这在我添加 Skrollr 菜单之前再次起作用。知道 Skrollr 菜单旁边的代码是什么吗?
谢谢!