我将翻译如下:
我有这个网址:example.com/index.html#tab-1
我在浏览器中输入以下网址example.com/index.html#tab-1并按回车键 - 页面不会加载。
我想获取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;
}