使用skrollr-菜单时从网址中删除#

时间:2014-03-30 18:06:49

标签: html css url-rewriting skrollr

我有一个网站,我使用skrollr和skrollr菜单。在我添加skrollr之前,每次按下导航按钮时我都会清理网址。添加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菜单的哪些内容超过了这段代码吗?

谢谢!

0 个答案:

没有答案