ポートフォリオコンテンツをサイトに動的に表示したかったのですが、ページ全体(ヘッダー+コンテンツ+フッター)を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では前に説明したように動作します:/