私はこの URL を持っています: example.com/index.html#tab-1
URL example.com/index.html#tab-1に従ってブラウザーに書き込み、Enter キーを押します - ページが読み込まれません。
パラメータ tab1 を取得し、id tab1 でコンテンツをロードしたいと考えています。
私のコード:
私はこの関数を呼び出します:
//to load
showTabContent(gethash);
showTabContent: function(id)
{
if(id != null)
{
var tabid = id.split("-");
$("#tab"+tabid[1]).show();
}
},
gethash: function()
{
var hash = window.location.hash;
if($.trim(hash) != "") return hash;
else return null;
}