好了,我要回答我的问题> _ <
无我没有地方在网络上找到了解决办法,我解决我自己......
的解决方案是jQuery的工具版本1.2.6 稳定
jQuery的工具代码,涉及历史工具,你可以从这里改变它:
(function(a){var b,c,d,e;a.tools=a.tools||{version:"v1.2.6"},a.tools.history={init:function(g){e||(a.browser.msie&&a.browser.version<"8"?c||(c=a("<iframe/>").attr("src","javascript:false;").hide().get(0),a("body").prepend(c),setInterval(function(){var d=c.contentWindow.document,e=d.location.hash;b!==e&&a(window).trigger("hash",e)},100),f(location.hash||"#")):setInterval(function(){var c=location.hash;c!==b&&a(window).trigger("hash",c)},100),d=d?d.add(g):g,g.click(function(b){var d=a(this).attr("href");c&&f(d);if(d.slice(0,1)!="#"){location.href="#"+d;return b.preventDefault()}}),e=!0)}};function f(a){if(a){var b=c.contentWindow.document;b.open().close(),b.location.hash=a}}a(window).bind("hash",function(c,e){e?d.filter(function(){var b=a(this).attr("href");return b==e||b==e.replace("#","")}).trigger("history",[e]):d.eq(0).trigger("history",[e]),b=e}),a.fn.history=function(b){a.tools.history.init(this);return this.bind("history",b)}})(jQuery);
更改为:(不需要新的线路,你可以删除它们,并返回到一个行)
(function(a)
{
var b,c,d,e;a.tools=a.tools||{version:"v1.2.6"},a.tools.history={init:function(g){e||(a.browser.msie&&a.browser.version<"8"?c||(c=a("<iframe/>").attr("src","javascript:false;").hide().get(0),
a("body").prepend(c),setInterval(function(){var d=c.contentWindow.document,e=d.location.hash;b!==e&&a(window).trigger("hash",e)},100),
f(location.hash||"#")):setInterval(function(){var c=location.hash;c!==b&&a(window).trigger("hash",c)},100),d=d?d.add(g):g,
g.click(function(b){var d=a(this).attr("href");
c&&f(d);if(d.slice(0,1)!="#"){location.href="#"+a(this).attr("name");return b.preventDefault()}}),e=!0)}};
function f(a)
{
if(a)
{
var b=c.contentWindow.document;
b.open().close(),
b.location.hash=a
}
}a(window).bind("hash",function(c,e){e?d.filter(function(){var b=a(this).attr("name");return b==e||b==e.replace("#","")}).trigger("history",[e]):d.eq(0).trigger("history",[e]),b=e}),
a.fn.history=function(b){a.tools.history.init(this);return this.bind("history",b)}
}
)
的变化是两个简单的变化: 此:
location.href="#"+d
改成这样:
location.href="#"+a(this).attr("name")
这:
var b=a(this).attr("href");
改成这样:
var b=a(this).attr("name");
还多了一个重要的事情,你需要将“NAME”属性添加到您的标签,并把你希望出现在后的地址名称#(在我来说,我希望出现在选项卡的同一路段/名),就像这样:
<!-- tabs -->
<ul class="css-tabs">
<li><a href="/example/a" name="ABC">ABC</a></li>
<li><a href="/example/b" name="DEF">DEF</a></li>
</ul>
<!-- single pane. it is always visible -->
<div class="css-panes">
<div style="display:block"></div>
</div>
就是这样,你现在有一个工作jQuery的工具选项卡的历史与“#NAME工作的选项卡“而不是”#href林K”:d 像这些:
www.example.com/example/a#ABC
www.example。com/example/b#DEF
如果您不想使用“name”属性,而是使用id或class,那么请更改我将名称放入id或class的位置,但请确保将id或class放在您的选项卡中太...