jQuery历史插件

有一些不同的jQuery历史插件有一个比其他任何更好…

我正在尝试决定使用哪一个,任何想法或其他任何尝试:

  • http://www.balupton.com/projects/jquery-history
  • http://tkyk.github.com/jquery-history-plugin
  • http://plugins.jquery.com/project/history

我不确定你要做什么,但我假设你想使用哈希标签来控制Twitter和Facebook等页面加载。

如果是这种情况,请查看以下post: https : //stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin

编辑:

这是该post的建议:

  • Asual: http : //www.asual.com/jquery/address/
  • jQuery BBQ: http : //benalman.com/projects/jquery-bbq-plugin/
  • 历史: http : //plugins.jquery.com/project/history
  • jQuery hashchange: http ://benalman.com/projects/jquery-hashchange-plugin/
  • ReallySimpleHistory: http : //code.google.com/p/reallysimplehistory/

就个人而言,我建议使用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(); }); 

资料来源: http : //benalman.com/code/projects/jquery-bbq/examples/fragment-basic/

另一个受欢迎的是Sammy.js( http://code.quirkey.com/sammy/ )这实际上是Twitter使用的。

  • 基督教

我尝试使用以下库

  • jQuery BBQ: http : //benalman.com/projects/jquery-bbq-plugin/
  • 历史: http : //plugins.jquery.com/project/history
  • ReallySimpleHistory: http : //code.google.com/p/reallysimplehistory/

并不满意。 最后我发现了新的(使用jquery 1.9.1)和简单的:

jQuery.history https://github.com/yeikos/jquery.history

不确定这是否有助于任何人,但这里是一个插件,可以帮助管理多个哈希“项目”。 https://github.com/Cipa/HashStack

您可以在散列中保存项目列表,例如某些选定元素的值,这些元素在更改时使用ajax重新加载页面的某些部分。