jQuery - 深入链接jQuery地址

Nic*_*ard 4 ajax jquery deep-linking

我真的想使用jQuery地址插件来深度链接我的ajax网站,但老实说,我很难理解如何设置它.

即使这些例子似乎也不清楚.

有没有人有一个关于如何使这个工作的简单例子?

Tre*_*vor 7

我第一次也经历过这个.他们的文档很差,但它是一个非常好的插件.

$.address.init(function(event) {

}).change(function(event) {
     // all your application work should be within here.
     // each time something changes this will run
     // use the api methods to find out what is going on.
     event.path // returns the current full path from beyond /#/
     event.queryString // returns the query string ex: /#/?page=1
     event.value // returns the value /#/Home
     // These can all be accessed globally by using $.address.path(), etc         

     // usage
     // example of clicking an a tag set with the ref or href set as a div id
     // be sure to set that in the init method above
     // Shows the selected div
     $('#'+event.value).show();

});
Run Code Online (Sandbox Code Playgroud)