個別の html ファイルからプロジェクトを取得する 1 ページのポートフォリオ サイトを開発しています。#project
したがって、現在、新しい URL (具体的にはdiv) を現在の div にロードするこのコードがあります#port-content
。
私のcustom.jsの一部は次のとおりです。
var hash = window.location.hash.substr(1);
var href = $('.ajax').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #project';
$('#port-content').load(toLoad)
}
});
$('a.port-more').click(function(){
var toLoad = $(this).attr('href')+' #project';
$('#port-content').hide('normal',loadContent);
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#port-content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#port-content').show('normal');
}
return false;
});
#port-content
このコンテンツを閉じて元のdivに戻すにはどうすればよいですか。反対のことをする新しい関数を作成しようとしましたが、うまくいきませんでした。
何か案は?