我想在网站上动态显示我的投资组合内容 - 通过 ajax 重新加载整个页面(页眉 + 内容 + 页脚),现在它工作正常,但网站很长,它在加载底部后显示 - 如何自动加载后滚动到投资组合部分?我试过使用.scrollTo()但它不起作用(也许我把它放在错误的行 - 请看看我的代码:
$(function(){
  $(".screen.fifth a[rel='tab']").click(function(e){
    //e.preventDefault();
    /*
    if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
    if commented, html5 nonsupported browers will reload the page to the specified link.
    */
    //get the link location that was clicked
    pageurl = $(this).attr('href');
    //to get the ajax content and display in div with id 'content'
    $.ajax({url:pageurl+'?rel=tab',success: function(data){
      $('.screen.fifth .main_wrapper').html(data);
    }});
    //to change the browser URL to the given link location
    if(pageurl!=window.location){
      window.history.pushState({path:pageurl},'',pageurl);
    }
    //stop refreshing to the page given in
    return false;
  });
});
请帮忙!
编辑:
我已将此页面的链接更改为<a href=".../project_one.php#project_tag">chrome,它工作得很好,但在 Firefox 中,它的行为就像我之前描述的那样:/