Javascript jQuery 历史插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4347168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery History Plugin
提问by vdh_ant
There are a few different jQuery history plugins out there is one better than any of the others...
有几个不同的 jQuery 历史插件,其中一个比其他任何一个都好......
I'm trying to decide which one to go with, any thoughts or any others to try:
我正在尝试决定要使用哪个,任何想法或任何其他尝试:
回答by Christian Joudrey
I'm not exactly sure what you are trying to do, but I'm assuming you want to use hash tags to control page loads like Twitter and Facebook.
我不确定您要做什么,但我假设您想使用哈希标签来控制页面加载,如 Twitter 和 Facebook。
If that's the case check out this post: https://stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin
如果是这种情况,请查看这篇文章:https: //stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin
Edit:
编辑:
Here's what was suggested on that post:
以下是该帖子中的建议:
- Asual: http://www.asual.com/jquery/address/
- jQuery BBQ: http://benalman.com/projects/jquery-bbq-plugin/
- History: http://plugins.jquery.com/project/history
- jQuery hashchange: http://benalman.com/projects/jquery-hashchange-plugin/
- ReallySimpleHistory: http://code.google.com/p/reallysimplehistory/
- Asual:http: //www.asual.com/jquery/address/
- jQuery 烧烤:http: //benalman.com/projects/jquery-bbq-plugin/
- 历史:http: //plugins.jquery.com/project/history
- jQuery 哈希更改:http://benalman.com/projects/jquery-hashchange-plugin/
- 真正简单的历史:http: //code.google.com/p/reallysimplehistory/
Personally, I'd suggest going with Ben Alman's jQuery BBQ as it is cross-browser and very easy to use. Basically:
就个人而言,我建议使用 Ben Alman 的 jQuery BBQ,因为它是跨浏览器的并且非常易于使用。基本上:
$(window).bind('hashchange', function(e) {
// Get the hash (fragment) as a string, with any leading # removed. Note that
// in jQuery 1.4, you should use e.fragment instead of $.param.fragment().
var url = $.param.fragment();
});
Source: http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/
来源:http: //benalman.com/code/projects/jquery-bbq/examples/fragment-basic/
Another popular one is Sammy.js (http://code.quirkey.com/sammy/) this is actually what Twitter uses.
另一个流行的是 Sammy.js ( http://code.quirkey.com/sammy/) 这实际上是 Twitter 使用的。
- Christian
- 基督教
回答by Sllouyssgort
I try to use following libs
我尝试使用以下库
- jQuery BBQ: http://benalman.com/projects/jquery-bbq-plugin/
- History: http://plugins.jquery.com/project/history
- ReallySimpleHistory: http://code.google.com/p/reallysimplehistory/
- jQuery 烧烤:http: //benalman.com/projects/jquery-bbq-plugin/
- 历史:http: //plugins.jquery.com/project/history
- 真正简单的历史:http: //code.google.com/p/reallysimplehistory/
and was not satisfied. Finaly I found fresh (working with jquery 1.9.1) and simple one:
并且不满意。最后我找到了新鲜的(使用 jquery 1.9.1)和简单的:
jQuery.historyhttps://github.com/yeikos/jquery.history
jQuery.history https://github.com/yeikos/jquery.history
回答by orbitory
Not sure if this helps anyone but here's a plugin that can help in managing multiple hash "items". https://github.com/Cipa/HashStack
不确定这是否对任何人有帮助,但这里有一个插件可以帮助管理多个哈希“项目”。 https://github.com/Cipa/HashStack
You can save a list of items in the hash like the values of some select elements that when changed reload some part of the page using ajax.
您可以在散列中保存项目列表,例如某些选择元素的值,这些元素在更改时会使用 ajax 重新加载页面的某些部分。