Nic Hubbard
Nic Hubbard

Reputation: 42157

jQuery - Getting deep linking jQuery Address to work

I am really wanting to use the jQuery address plugin for deep linking my ajax website, but honestly, I have having a hard time understanding how to set it up.

Even the examples seem to not be clear.

Does anyone have a simple example on how to get this working?

Upvotes: 4

Views: 6113

Answers (1)

uadnal
uadnal

Reputation: 11435

I went through this my first time as well. Their documentation is poor, but it is a very good plugin.

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

});

Upvotes: 7

Related Questions