4

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

甚至这些例子似乎都不清楚。

有没有人有一个简单的例子来说明如何让它工作?

4

1 回答 1

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();

});
于 2011-03-12T16:35:18.553 回答