jQuery History Plugin

断了今生、忘了曾经 提交于 2019-11-28 04:34:49
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.

If that's the case check out this post: https://stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin

Edit:

Here's what was suggested on that post:

Personally, I'd suggest going with Ben Alman's jQuery BBQ as it is cross-browser and very easy to use. Basically:

$(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/

Another popular one is Sammy.js (http://code.quirkey.com/sammy/) this is actually what Twitter uses.

  • Christian

I try to use following libs

and was not satisfied. Finaly I found fresh (working with jquery 1.9.1) and simple one:

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

Not sure if this helps anyone but here's a plugin that can help in managing multiple hash "items". 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!