2009-11-04 53 views

回答

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

}); 
+0

任何想法如何讓它使用最新的jQuery版本? – kwoxer 2015-02-17 09:07:26

+1

不知道。 Twas 4年前:( – Trevor 2015-02-20 16:21:03

+1

http://stackoverflow.com/questions/28495507/deep-linking-with-ajax-does-not-work-with-latest-jquery-address/28594019#28594019是解決方案,但一個壞風格與降級= / – kwoxer 2015-02-20 17:04:25