私はすでに同様の状況がありました。タブはページを持ち、メニューはトップページにありました。あなたはこのソリューション適用することができます:あなたはdivタグを使用している場合、このロジックは、IFRAMEで動作します
を、あなたはこのために調整することができます。
メインページのナビゲーションメニューで、ここであなたは、このようないくつかのロジックを適用が必要です。
をページをリロードするapllyコードのこの部分を必要とするコンテンツのページで
<script>
//Object to get values of URL (GET)
var request = {
get get() {
var vars = {};
if (window.location.search.length !== 0)
window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
key = decodeURIComponent(key);
if (typeof vars[key] === "undefined") {
vars[key] = decodeURIComponent(value);
}
else {
vars[key] = [].concat(vars[key], decodeURIComponent(value));
}
});
return vars;
},
getParam: function (param) {
var vars = request.get;
if (vars[param] != undefined) {
return vars[param];
} else {
return null;
}
}, getParams: function() {
return request.get;
}
};
//variable that defines if the client are in mainWindow
window.mainWindowFrame = true;
var tabName = request.getParam("tab");
console.log("tabName",tabName);
//call some function to reload the content of iframe or div to requested tab.
//if(tabName != null || tabName != ""){
//tabs.load(tabName) ....
//}
</script>
メニューが存在しない場合:コンテンツとそのPHPファイル内
<script>
//name of this tab
var tabName = "someTab";
//check if the menu are present here
if(window.top.mainWindowFrame == undefined){
window.location.href = "mainpage.html?tab="+tabName;
}
</script>
、それならば、AJAXリクエストをチェックし、もし私がtはコンテンツを表示していない場合は全体を表示します –
コンテンツは2つのPHPファイル、メインファイル、およびコンテンツ内にdinamycally読み込まれたファイルです。次に、それがajaxでない場合はコンテンツを設定する必要があります内側のファイルを読み込まないようにしますが、内側のファイルは読み込みません。 @David Lavieri – vjsp90
私は[github](https://gist.github.com/falmar/4889263ce3187d0bf1a8ea1690b34d08)のアイデアを作りました。それはおそらくもっとよく理解できます –